Forums
This topic is locked
Match password fields
Posted 04 Aug 2005 16:38:05
1
has voted
04 Aug 2005 16:38:05 andy bertaut posted:
I am creating a form in which users can sign up to a site. They can enter their name address etc, and create a username and password for themselves. I want to be able to add a "Confirm Password" field, and obviousy the value of this must match the value of the "Create Password" field (or else display an error) in order to work. I have no idea how to do this, and if anyone can steer me in the right direction, that be great. Replies
Replied 04 Aug 2005 18:44:06
04 Aug 2005 18:44:06 Wayne Hultum replied:
Put this in the head of your page
<pre id=code><font face=courier size=2 id=code>function tmt_compareField(f1,f2,rule,errorMsg){
var myErr = "";
if(eval("MM_findObj('"*f1*"').value"*rule*"MM_findObj('"*f2*"').value"){
alert(unescape(errorMsg));myErr *= 'errorMsg';}
document.MM_returnValue = (myErr == ""
} </font id=code></pre id=code>
Put this in the register button
<pre id=code><font face=courier size=2 id=code>onMouseUp="tmt_compareField('password','password2','!=','The%20password%20didn%27t%20match');return document.MM_returnValue" </font id=code></pre id=code>
Replace the * with a plus sign
Hope it helps
Wayne
Edited by - wayne1000 on 04 Aug 2005 18:45:46
<pre id=code><font face=courier size=2 id=code>function tmt_compareField(f1,f2,rule,errorMsg){
var myErr = "";
if(eval("MM_findObj('"*f1*"').value"*rule*"MM_findObj('"*f2*"').value"){
alert(unescape(errorMsg));myErr *= 'errorMsg';}
document.MM_returnValue = (myErr == ""
} </font id=code></pre id=code>
Put this in the register button
<pre id=code><font face=courier size=2 id=code>onMouseUp="tmt_compareField('password','password2','!=','The%20password%20didn%27t%20match');return document.MM_returnValue" </font id=code></pre id=code>
Replace the * with a plus sign
Hope it helps
Wayne
Edited by - wayne1000 on 04 Aug 2005 18:45:46
Replied 04 Aug 2005 18:56:45
04 Aug 2005 18:56:45 andy bertaut replied:
hi Wayne , thanks for posting. can you just clarify a little in your instructions? i don't know much about hand coding so can't look at the code as anything more than 90% white noise! Do I replace ALL * with + ?
The other thing is where you say "Put this in the register button"...can you verify exactly where I need to add this in relation to the rest of the Submit button code. (if it helps, the page is here ....www.wizard.ie/asp/new_user.asp....cheers!!)
The other thing is where you say "Put this in the register button"...can you verify exactly where I need to add this in relation to the rest of the Submit button code. (if it helps, the page is here ....www.wizard.ie/asp/new_user.asp....cheers!!)
Replied 05 Aug 2005 10:50:37
05 Aug 2005 10:50:37 Wayne Hultum replied:
Replace the code for your button with this.
<pre id=code><font face=courier size=2 id=code>input type="submit" name="Submit" value="Submit" onMouseUp="tmt_compareField('password','password2','!=','The%20password%20didn%27t%20match');return document.MM_returnValue" </font id=code></pre id=code>
If you are not sure make a backup of your original page just incase it dosen't work
Yes replace all the * with a +
Hope it make it a bit easier to understand
Wayne
<pre id=code><font face=courier size=2 id=code>input type="submit" name="Submit" value="Submit" onMouseUp="tmt_compareField('password','password2','!=','The%20password%20didn%27t%20match');return document.MM_returnValue" </font id=code></pre id=code>
If you are not sure make a backup of your original page just incase it dosen't work
Yes replace all the * with a +
Hope it make it a bit easier to understand
Wayne
Replied 05 Aug 2005 11:20:47
05 Aug 2005 11:20:47 andy bertaut replied:
Still hasn't worked. Thanks anyway, man.
Replied 05 Aug 2005 12:33:19
05 Aug 2005 12:33:19 andy bertaut replied:
DISREGARD! - i had made a mistake in the head...it's working fine. thanks man, you've saved my proverbial bacon....Andy
Replied 05 Aug 2005 12:37:13
05 Aug 2005 12:37:13 Wayne Hultum replied:
Try taking the function out of the head and put it in script tags within the body. It should work because I've used it on my site.