validation - jquery validate with multiple rules -


how validate email address field 3 rules 3 customized messages in div container. ie.

rules: {     email: {         validationrule: true,         email: true,         remote: '/ajax/emailduplicationcheck.php'        }      } 

if first 1 false message should "validation rule failed"

if second 1 false(fail) "enter email address"

if third(remote) failed. message should "account exist in database".

i can added 1 message rules want customize message respect rules.

try this:

$("#myform").validate({ // replace #myform id of form     rules: {         email: {             required: true,             email: true,             remote: {                 url: "/ajax/emailduplicationcheck.php",                 type: "post",                 data: { email: function() {                     return $("#email").val(); // add #email id email field                 }             }         }     },     messages: {         email: {             required: 'email address required',             email: 'please enter valid email address',             remote: 'this email address has been used'         }     },     errorplacement: function(error) {         $("#response").html(error);     } }); 

hope helps !


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -