在我的网站上,我需要在表单中使用验证,但表单中有标签。运行.validate()
时,我想highlight
无效输入并弹出一条摘要消息,说明您遇到问题,然后转到X标签进行修复。 showErrors
似乎阻止highlight
方法
弹出作品,highlight
没有。删除showError
和highlight
投放
这是我的代码:
$("#frmMyForm").validate({
onclick: false,
onkeyup:false,
ignore: ":disabled",
rules: {
PasswordExpiryDays: { required: true, number: true, min: 30, max: 90 },
PasswordStrength: { required: true, number: true, min: 10, max: 50 }
},
messages: {
PasswordExpiryDays: {
required: " This can't be left blank",
min: "Please enter a number between 30 and 90",
max: "Please enter a number between 30 and 90"
},
PasswordStrength: {
required: " This can't be left blank",
min: "Please enter a number between 10 and 50",
max: "Please enter a number between 10 and 50"
}
},
showErrors: function (errorMap, errorList) {
//code for error message pop-up
}
});
答案 0 :(得分:1)
好,包括
this.defaultShowErrors();
showErrors
上的修复了问题