Password Validation

[Total: 0    Average: 0/5]

This script will ensure that the password entries match.

Head Code:

function validForm(passForm) { 
  if (passForm.passwd1.value == "") { 
    alert("you must enter a password");
    return false;
  if (passForm.passwd1.value != passForm.passwd2.value) { 
    alert("Entered passwords did not match");
    return false;
  return true;

Body Code:

<form name="form" action="" onsubmit="return validForm(this)">
Your name: <input type="text" name="textfield">
Choose a password: <input type="password" name="passwd1" value="abc123">
Verify password: <input type="password" name="passwd2" value="abc123">
<input type="submit" value="Submit">  
<input type="reset"> 

Times Viewed: 12

Leave a Reply

Your email address will not be published. Required fields are marked *