Wednesday, April 13, 2011

what is the built-in javascript function to return the validator state in asp.net

This is a bit of a tough question to ask. I am using asp.net validators, but I want to tie them to a simple click event which I bind with jQuery.

I have found that I can use:

ValidatorValidate($("#<%= rfvFirst.ClientID %>")[0]);

to fire the rfvFirst validator, but I do not know how to get the actual false return somewhere to tell me that the form is not valid.

All I need is the function or variable or property that I can call on (client side) to tell me if the form is valid.

I hope that makes sense, thank you.

From stackoverflow
  • If your using validation groups you can do:

    if (Page_ClientValidate('Group Name'))
    {
     //Valid
    }
    
    Stuck In Baghdad : perfect, thank you!
  • Page_IsValid would tell you whether the Page is valid. you can also use the isvalid property of the validator to validate the individual validator.

0 comments:

Post a Comment