Connecting Tech Pros Worldwide Help | Site Map

password validation

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:50 AM
brijesh
Guest
 
Posts: n/a
Default password validation

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, 11:50 AM
kaeli
Guest
 
Posts: n/a
Default 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
-------------------------------------------------
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.