Response title
This is preview!
I am missing something simple I bet. I have a working MVC form that uses JQuery validation emitted via Data Annotations. To simplify, the form has one textbox (UserName). UserName has a Required Data Annotation. I call this in the form.submit:
$('#frmAddUser').validate();
var isValid = $('#frmAddUser').valid();
if (!isValid) {
return false;
}
If UserName is blank then form.valid is false. But if I move form.validate to document.ready then form.valid is true even when UserName is blank.
Why did moving my form.validate to a global scope break my validation and how can I fix this? I didn't want to complicate my question but I was moving form.validate to a global scope because I wanted to add dynamic rules to it.
© 2013 jQuery Foundation
Sponsored by and others.