I am having an issue with the JQuery Validation Plugin. I'm using it on a rails form, and I have validation working on clicking the submit button. The issue is that once the validation erro开发者_如何学Crs are fixed the submit button does not come back from being disabled, and even with the submitHandler as
$.validator.setDefaults({
submitHandler: function(form) { form.submit(); }
});
the form won't submit. I know there's got to be something I'm missing. The form will submit if there are no validation issues. I've checked out some of the other messages here about this issue but the onclick and onkeyup stuff doesn't work.
Try this
var validator = $("#signupForm").validate({
rules: {
},
messages:{
},
unhighlight: function( element, errorClass, validClass ) {
$(element).removeClass(errorClass).addClass(validClass);
if(validator.numberOfInvalids() == 0){
$("#SubmitButton").attr("disabled","");
}
}
});
精彩评论