Click to See Complete Forum and Search --> : Verify password ?
developer
09-14-2003, 10:45 PM
Hello!
My first post here. :)
I do have a sign up fom with:
Password:
Enter Password Again:
(pw1 and pw2 is the names)
How do I please check if they are the same, and if they are not have a pop up window saying that?
Thanks,
<form action="" name="myForm" onsubmit="if(this.form.pw1.value != this.form.pw2.value){ alert('Password values do not match.'); return false;}"><div>
<input type="password" name="pw1"><br>
<input type="password" name="pw2"><br>
<input type="submit" value=" Submit ">
</div></form>
[J]ona
developer
09-14-2003, 11:53 PM
Hi! :)
Thanks a lot for the suggestion. I do alreaduy have a onsubmit in the form tag so it won't work, so I am now trying to put your code in the head with the other validation.
if (tomtvalidation(username,"Enter user name please")==false)
{username.focus(); return false;};
if (tomtvalidation(password,"Enter password please")==false)
{password.focus(); return false;};
if (tomtvalidation(verifypassword,"Enter verify password please")==false)
{verifypassword.focus(); return false;};
if(this.form.password.value != this.form.verifypassword.value)
(alert('Password values do not match.'); return false;);
developer
09-14-2003, 11:54 PM
if(this.form.password.value != this.form.verifypassword.value)
(alert('Password values do not match.' ) ; return false ; ) ;
That is.
Not quite, change the this.form part to document.forms["name_of_the_form"]
[J]ona
Jeff Mott
09-14-2003, 11:56 PM
I do alreaduy have a onsubmit in the form tag so it won't workYou can separate different statements with a semi-colon.
Originally posted by Jeff Mott
You can separate different statements with a semi-colon.
He probably just wants to put it all in one function to simplify it.
[J]ona
developer
09-15-2003, 12:29 AM
Hello again!
I really don't get the pieces together. :(
How do I please add(with semicolon)
<FORM METHOD=POST ACTION="register.php" onsubmit="return formvalidation(this)>
and
onsubmit="if(this.form.pw1.value != this.form.pw2.value){ alert('Password values do not match.'); return false;}"
Thanks again...
developer
09-15-2003, 02:34 AM
Works now.
*happy* :)
if(register.password.value != register.verifypassword.value)
{alert('Password values do not match.'); return false ;};
Glad you got it working. :)
[J]ona