views:

21

answers:

0

Ok so from my previous post I got a lot of good feedback. I am starting this one so that I can start a new question and add the full code I have. i know something is messing up, but here is my method and implementation.

jquery.validator.addMethod("passwordRules", function(input) {
    var reg = /^{^%\s]{6,}$/;
    var reg2 = /[a-zA-Z]/;
    var reg3 = /[0-9]/;
    return reg.test(input) && reg2.text(input) && reg3.test(input);
});

that is my add method. here is how I am trying to apply it to the new password field. My question here is do i use required? I am lost.

$("<%= NewPass1.GetName() %>").validate({
    rules:{
        required: { passwordRules: true }
}, messages: {
    "<%= NewPass1.GetName() %>": {
required: WrapError("Invalid", "The password contains invalid....")}
  }
});

I just need to reassure that the password box only allows min of 6 chars, no spaces or %, at least one number and at least one letter.