问题描述
JQuery验证插件出现问题.我在Rails表单上使用它,并且在单击提交"按钮时进行了验证.问题在于,一旦纠正了验证错误,就不会再禁用提交按钮,即使将commitHandler设置为
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 errors 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(); }});
$.validator.setDefaults({ submitHandler: function(form) { form.submit(); }});
该表单不会提交.我知道一定有我想念的东西.如果没有验证问题,将提交表格.我已经在这里查看了有关此问题的其他一些消息,但是onclick和onkeyup的东西不起作用.
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.
推荐答案
尝试一下
var validator = $("#signupForm").validate({
rules: {
},
messages:{
},
unhighlight: function( element, errorClass, validClass ) {
$(element).removeClass(errorClass).addClass(validClass);
if(validator.numberOfInvalids() == 0){
$("#SubmitButton").attr("disabled","");
}
}
});
这篇关于jQuery验证插件在验证后重新启用提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!