Connecting Tech Pros Worldwide Help | Site Map

password validation

  #1  
Old July 20th, 2005, 12:50 PM
brijesh
Guest
 
Posts: n/a
i am relatively new to javascript
i am trying for a password validation code
but iam not able to stop the page from loading the page when the
password is wrong. the code is as below
------------------
<html>
<head>
<title>New User</title>
<script language = "JavaScript">
function validatePasswords() {
if (document.passForm.password1.value !=
document.passForm.password2.value) {
alert("Passwords don't match, try again");
document.passForm.password1.focus();
document.passForm.password1.select();
return false;
} else
return true;
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="passForm" method="post" onsubmit="validatePasswords()"
action="http://www.google.com">
<h1>New user password form</h1>
<p> Username: <input type="text" name="username"><br>
Password: <input type="password" name="password1"><br>
Check password: <input type="password" name="password2"><br>
<input type="submit" name="Submit" value="Submit">
</p>
</form>

</body>
</html>
-------------------
can u please tell me where am i going wrong
thank you
waiting eagerly for some suggestions
Brijesh
  #2  
Old July 20th, 2005, 12:50 PM
kaeli
Guest
 
Posts: n/a

re: password validation


In article <7bccde45.0311130230.2ecccc21@posting.google.com >,
brijesh@divinetaccess.com enlightened us with...[color=blue]
> i am relatively new to javascript
> i am trying for a password validation code
> but iam not able to stop the page from loading the page when the
> password is wrong. the code is as below
>
> <body bgcolor="#FFFFFF" text="#000000">
> <form name="passForm" method="post" onsubmit="validatePasswords()"[/color]

You forgot the return.
onsubmit="return validatePasswords()"



--
-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to provide password validation and also email validation for a registration form shwethatj answers 1 September 18th, 2008 03:58 PM
Password validation for setup project in VS.Net 2003 Steven answers 0 May 4th, 2006 03:15 AM
Password validation for setup project in VS.Net 2003 Steven answers 0 May 3rd, 2006 09:55 AM
Password validation in ASP.NET - Please help bienwell answers 0 January 10th, 2006 01:25 PM