I am using remote jquery validation in a drop down field to check if the selected field exists or not. The general code works fine and is checked correctly. But the problem is remote verification of sending ajax call after the onChange event, it means that it shows a unique key verification error after clicking anywhere on the page.
I want to check it as soon as the user clicks on the drop-down list. I tried onclick:true, but it does not work. Check out my code:
$("#myform").validate({
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."}
}
});
Thank. Any help would be appreciated.
source
share