I am using jquery validation plugin (http://jqueryvalidation.org/) for form validation. There is a field I want to do remote validate.
Example code:
$( "#myform" ).validate({
rules: {
email: {
required: true,
email: true,
remote: "check-email.php"
}
}
});
When it is not valid, it display "Please fix this field." How can I have custom error message for the remote validate such as "Email address already in used. Please use other email."?
Thank you.
here is the solution
rules: {
shopname:
{
required: true,
remote:"code.php",
},
}
Now in your code.php file-
If input is ok then display NOTHING.
if input incorrect then you have to display a QUOTED text like-
echo '"This Username is booked You Should Try VIVEK98779797 "';
so now by this code you can display custom error message by PHP using remote method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With