Forums
This topic is locked
validating password fields on forms
Posted 09 Jul 2001 13:08:12
1
has voted
09 Jul 2001 13:08:12 Peter Pritchard posted:
When you create too password form fields how do you make it so when the user types the password for the second time it alerts you that both passwords did not match, is this done with javascript ? if so any idea how. Thanks in advance, peter.Replies
Replied 09 Jul 2001 14:49:28
09 Jul 2001 14:49:28 Joel Martinez replied:
sure... apply the call javascript behavior to the submit button, and enter this code:
<font face='Times New Roman'>
if (document.form1.pass1.value != document.form1.pass2.value) {alert('the two passwords do not match');return false;}
</font id='Times New Roman'>
of course make sure to replace the "form1" with the name of your form, and the "pass1|2" with the names of your password fields..
if you get a JS error, just post again and I'll fix it.
<b>Joel Martinez</b>
----------
Is this thing on?....
<font face='Times New Roman'>
if (document.form1.pass1.value != document.form1.pass2.value) {alert('the two passwords do not match');return false;}
</font id='Times New Roman'>
of course make sure to replace the "form1" with the name of your form, and the "pass1|2" with the names of your password fields..
if you get a JS error, just post again and I'll fix it.
<b>Joel Martinez</b>
----------
Is this thing on?....
Replied 09 Jul 2001 17:56:09
09 Jul 2001 17:56:09 Peter Pritchard replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
sure... apply the call javascript behavior to the submit button, and enter this code:
<font face='Times New Roman'>
if (document.form1.pass1.value != document.form1.pass2.value) {alert('the two passwords do not match');return false;}
</font id='Times New Roman'>
of course make sure to replace the "form1" with the name of your form, and the "pass1|2" with the names of your password fields..
if you get a JS error, just post again and I'll fix it.
<b>Joel Martinez</b>
----------
Is this thing on?....
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi Joel, I did get a error with that one can you fix it please, as I am shit at programming and scripting
sure... apply the call javascript behavior to the submit button, and enter this code:
<font face='Times New Roman'>
if (document.form1.pass1.value != document.form1.pass2.value) {alert('the two passwords do not match');return false;}
</font id='Times New Roman'>
of course make sure to replace the "form1" with the name of your form, and the "pass1|2" with the names of your password fields..
if you get a JS error, just post again and I'll fix it.
<b>Joel Martinez</b>
----------
Is this thing on?....
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi Joel, I did get a error with that one can you fix it please, as I am shit at programming and scripting
Replied 09 Jul 2001 18:19:34
09 Jul 2001 18:19:34 Joel Martinez replied:
well, I did some testing, and it seems that my script wont work with the call javascript behavior... so I tweaked the code, the only bad thing is that you'll have to paste this in the code view for it to work:
<input type="submit" name="submit" value="Submit" onClick="if (document.form1.pass1.value != document.form1.pass2.value) {alert('Password fields do not match');document.MM_returnValue = false} else {document.MM_returnValue = true};return document.MM_returnValue">
again, make sure to replace the document.form1.pass1|2.value with the correct names for your webform
hope it helps,
Joel Martinez
----------
Is this thing on?....
<input type="submit" name="submit" value="Submit" onClick="if (document.form1.pass1.value != document.form1.pass2.value) {alert('Password fields do not match');document.MM_returnValue = false} else {document.MM_returnValue = true};return document.MM_returnValue">
again, make sure to replace the document.form1.pass1|2.value with the correct names for your webform
hope it helps,
Joel Martinez
----------
Is this thing on?....
Replied 09 Jul 2001 18:47:17
09 Jul 2001 18:47:17 Peter Pritchard replied:
Thanks Joel it worked, next time I am in Orlando Flordia I will bye you a beer,
well, I did some testing, and it seems that my script wont work with the call javascript behavior... so I tweaked the code, the only bad thing is that you'll have to paste this in the code view for it to work:
<input type="submit" name="submit" value="Submit" onClick="if (document.form1.pass1.value != document.form1.pass2.value) {alert('Password fields do not match');document.MM_returnValue = false} else {document.MM_returnValue = true};return document.MM_returnValue">
again, make sure to replace the document.form1.pass1|2.value with the correct names for your webform
hope it helps,
Joel Martinez
----------
Is this thing on?....
well, I did some testing, and it seems that my script wont work with the call javascript behavior... so I tweaked the code, the only bad thing is that you'll have to paste this in the code view for it to work:
<input type="submit" name="submit" value="Submit" onClick="if (document.form1.pass1.value != document.form1.pass2.value) {alert('Password fields do not match');document.MM_returnValue = false} else {document.MM_returnValue = true};return document.MM_returnValue">
again, make sure to replace the document.form1.pass1|2.value with the correct names for your webform
hope it helps,
Joel Martinez
----------
Is this thing on?....
Replied 09 Jul 2001 22:57:30
09 Jul 2001 22:57:30 Joel Martinez replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Thanks Joel it worked, next time I am in Orlando Flordia I will bye you a beer,
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
thanks...<img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle>
----------
Is this thing on?....
Thanks Joel it worked, next time I am in Orlando Flordia I will bye you a beer,
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
thanks...<img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle>
----------
Is this thing on?....
Replied 15 May 2003 22:19:35
15 May 2003 22:19:35 Mark Drelinger replied:
Great code...thanks
Replied 16 May 2003 00:30:11
16 May 2003 00:30:11 Lee Diggins replied:
Hi
Try the DMX form validation at www.yaromat.com you'll find it useful me thinks.
Digga
Sharing Knowledge Saves Valuable Time!!!
Try the DMX form validation at www.yaromat.com you'll find it useful me thinks.
Digga
Sharing Knowledge Saves Valuable Time!!!