4

I am trying to allow all special characters in register page in password field.

As of now it only allows /[$@$!%*?&#^ ]/

But I want to allow all. like: ^[@!#\$\^%&*()+=-[]\\';,./{}\|\":<>\? ]+$

So how can I customize validate.js for specific class validate-password.

Code:

    ['validate-password', 'Please enter 8 or more characters. Password must contain Numeric, Alphabetic and Special characters.', function(v) {
              var pass=v.strip(); /*strip leading and trailing spaces*/
                //alert(pass);
               // var fname =$(firstname).value;
               // alert(pass.indexOf(substring) !== -1);
               //var lname = $(lastname).value;
                if (0 == pass.length) {
                return true;
            }
            if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v)) || !(/[$@$!%*?&#^]/.test(v))) {  
                return false;
            }
/*            if((pass.indexOf(fname) > -1) ||(pass.indexOf(lname) > -1)){
                return false;
            } */
                return !(pass.length>0 && pass.length < 8);
            }],

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.