I have a customized registration form that I am using on two different sites. There are two fields, user_pass and pass2. The user_pass field has the following validation class:
class="validate[required,custom[password],minLength[7]]"
The custom regex in the language file looks like this:
"password":{
"regex": /^(.*\d.{2,})|(.*[@#?$%^&+=\*].*)(.?[a-z].*)$/,
"alertText": "* Must contain letters, numbers and symbols."
},
Then the pass2 field has the following validation class:
class="validate[required,equals[user_pass]]"
If you go to mosleyfamilies.net/user-registration, you can see the form in action. When you follow the instructions to put in a password and then repeat it exactly in the next field, you will get a fields don’t match error — even though they do.
If you then go to uniquelyyours.blogdns.com/simple-registration and do the exact same thing, the passwords will validate correctly. Firebug shows no errors and I tried to disable some plugins I thought might be interfering, but that did nothing.
For the life of me, I can’t figure out why the fields aren’t validating on mosleyfamilies.net when everything is exactly the same on both sites. Any help would be greatly appreciated! Thank you!
I don’t know if this fixes everything but, in your first piece of code you should use minSize instead of minLenght if you want to limit the minimum number of characters.
Validation Examples
Though it isn’t clear if my similar issue matches the original poster’s example, I had a similar problem due to the element id not being provided. It seems the equals function in the jquery.validation.js engine relies on the id of the element to match against. For example:
Won’t work because the “equals” function needs an element id to latch on to. Just add the id, like so: