ASP CustomValidator, advancing to postback after error

后端 未结 3 713
死守一世寂寞
死守一世寂寞 2021-01-22 19:55

I have an ASP .NET page with ASP validators (Required Field, Regular Expression,...) plus java script functions for additional validation (for example, to check if second date b

3条回答
  •  日久生厌
    2021-01-22 20:25

    When using a CustomValidator, the client side validation function needs to accept a source and an arguments parameter. Then, to mark the validation as failed, you set arguments.IsValid to false. Here is the MSDN page for the CustomValidator.

    function validate(source, arguments) {
       // ...
    
       alert('Not valid!');
       arguments.IsValid=false;
    }
    

提交回复
热议问题