Validation (password) | JavaScriptSource

Validation (password)

Russ Swift Feb 2, 2001
This script works like our Password Verifier, however, it also checks for a minimum length and invalid characters.
Enter your password twice.
(At least 6 characters, 12 characters max, and spaces are not allowed.)

Password:
Verify password:

The JavaScript Source: Forms: Validation (password)

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!

    

Did you use this script?  Do you like this site?  Please link to us!

Leave a Response

(
4 comments)

It doesn't work on this page, and it doesn't work on mine either. I figured I'd save time and rather than reinvent the wheel, I'd use yours but the submit button doesn't call the script it seems... Can you figure out why? Thanks

Manny Sep 10, 2012

[removed] function checkForm(form) { if(form.username.value == "") { alert("Error: Username cannot be blank!"); form.username.focus(); return false; } re = /^\w+$/; if(!re.test(form.username.value)) { alert("Error: Username must contain only letters, numbers and underscores!"); form.username.focus(); return false; } if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value) { if(form.pwd1.value.length

pardeep Jul 14, 2012

it`s very helpful for me !

munna Mar 25, 2012

thanku for pulishing this code. please if you help me further. i am not getting hw to write code for making restriction on password i.e my password should contain atleast one lower case, upper case, numbers, special symbol. please if you can mail me your reply

shruti dengre Mar 25, 2012