ASP.NET Mvc 2 How do you launch client side validation from inside javascript?
asp.net-mvc, asp.net-mvc-2
Solution
As basilmir and Dom Ribaut implies you should get this automatically if you EnableClientValidation(). However if you want to manually call client side MVC validation you can use:
if (!Sys.Mvc.FormContext.getValidationForForm($("#myform").get(0)).validate('submit').length) {
// is valid
}
You can replace `$("#myform").get(0)` with the DOM element for your form.
Problem
Is there a function for ASP.NET MVC 2 built in data annotation javascript validation that performs the functionality of Jquery.Validate's isValid()? I'd like to check if my fields are valid prior to using jquery ajax to send data to the server? Any suggestions? Thank You.