solution Posted February 8, 2023 Share Posted February 8, 2023 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 More sharing options...
solution Posted February 8, 2023 Author Share Posted February 8, 2023 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now