I have configured a Grunt file to build a single JS file with all my libraries and my code, so I only have the single JS file to included in my site. This is all working fine but I have just added the JQuery Validate plugin into it (http://jqueryvalidation.org/) and this plugin is working but not completely, I take it for red that its my code and how I have built it.
But I have a number of forms, and once of which is changing the users email. I should also say here that I am building the this site using CakePHP with its form helpers (although that side of the site is fully working without any errors).
This is the code I am using:
$( "#EmailChange" ).validate({
rules: {
'data[Email][currentemail]':{
required: true,
email: true
},
'data[Email][newemail]':{
required: true,
email: true
},
'data[Email][emailconfirm]': {
equalTo: "#NewEmail", <-id for the [email][newemail] input
required: true,
email: true
}
},
messages: {
'data[EmailUpdate][currentemail]': "email address is needed",
'data[EmailUpdate][newemail]': "a vaild email address is needed",
'data[EmailUpdate][emailconfirm]': "second email does not match",
}
});
Now this works, sort of but does not verify my email address right, I will enter, someemail@something
and this would remove or come back as valid email, before the domain suffix is entered. When I use the test field on the email on there own website, it does not do this, it only comes back as valid after the user inputs the suffix.
So what am I doing wrong?
Thanks.