Tried posting this before but it did not go through (i think) so if this is a repost please disregard. However, I asked a question yesterday and figured it out with the wonderful help from here. I have a user account page where a user can edit their account information. Now, they don’t always change their password. So, I made the Current Password box required only when the new password box had an input. I also applied equalTo: so that I can check the confirm password box with the new password box. That is all working. However, now I want to apply some rules to the new password box. Like the password has to be at least 6 chars long, contain one letter and one number, and not contain other characters. Can somebody please point me in the right direction?
here is some of the code I have for the min length:
$(<%= NewPass1.GetName() %>").rules("add", {
minlength: 6,
SOME REGEX HERE?
Try this function. It checks that the password is alphanumeric and at least 6 characters long. It also checks that it contains at least one digit and one letter.
I assume you are using the Validation plugin. To use a custom method with the plugin, try this function: http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage
EDIT:
Edited to allow all characters except spaces and ‘%’.