Jump to content

Validate password field


solution

Recommended Posts

Please i need to validate the password field this way, must contain atleast one uppercase letter, lowercase, number.
please i need this to be in someway this format not in jquery cause i have other if statement for other fields.
Not a JS Expert tho.
Thanks 
if(!/^[a-zA-Z]*$/g.test(document.regForm.password.value)) {
							alert("Password must contain an Alphabet(Upper ), Number,");
							document.regForm.lastname.focus();
							return false;
						}

 

Link to comment
Share on other sites

if(!firstpassword.match((/^(?=.\d)(?=.[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/))) {
							alert("Password must be Alphanumeric");
							return false;
						}

Above is the code.

It print "Password must be alphanumeric" even if it has combination of both

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...