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.)

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


thank you for this code.. it was easy to understand...

vishal Jul 17, 2015

your code is having a small mistake at the place of check for minimum length.. Please correct it.

Mathi May 26, 2014

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