我在下拉字段上使用 JQuery 远程验证来检查所选字段是否已经存在。整体代码工作正常并正确验证。但问题是在 onChange 事件之后发送 ajax 调用的远程验证,这意味着它在单击页面上的任何位置后显示唯一键验证错误。
一旦用户点击下拉选项,我想验证它。我试过onclick:true
了,但它不起作用。请检查我的代码:
$("#myform").validate({
// onclick:true,
// onkeyup:true,
rules: {
"customer[customer_personal_details_id]": {
required: true,
remote: {
url: "/validation/check",
type: "post",
data: {
columnVal: function () {
return $("#customer_customer_personal_details_id").val();
}
}
}
}
},
messages: {
"customer[customer_personal_details_id]": {
required: "Please Select Account Holder",
remote: "One active account already exists. Duplicate accounts are not allowed."}
}
});
谢谢。任何帮助,将不胜感激。