You're getting an error from your function because of the carriage return in
your alert message.
You need to use \n (or is it /n) to put a line break in an alert message.
This is probably killing off the exisitance of your function, so that the
call from the onBlur can't find it.
Regards
Stephen
----- Original Message -----
From: "Ian Westbrook" <[EMAIL PROTECTED]>
To: "cfug dev list" <[EMAIL PROTECTED]>
Sent: Friday, June 06, 2003 10:00 AM
Subject: [ cf-dev ] confirm password value...
Hi
can't get this script to work at all. can anyone spare a moment?
this is the script, in the head of register.cfm
<script language="javascript">
function CheckValues() {
if (document.register.password1.value !=
document.register.password2.value) {
alert("The values for \'password\' and \'confirm pasword\' are
different.
Please make sure both fields are the same.");
return false;
} else {
return true;
}
}
</script>
this is the call, in an include called by that page
(includes/registration.cfm)
<tr>
<td align="right"><b>confirm password</b> <sup><font
color="red"><b>*</b></font></sup></td>
<cfif IsDefined("session.loggedin") AND session.loggedin IS 'yes'>
<td>
<input type="password" name="password2" size="15"
value="<cfoutput>#getuser.password#</cfoutput>" onBlur="CheckValues();">
<cfelse>
<td>
<input type="password" name="password2" size="15" onBlur="CheckValues();">
</cfif>
</td>
</tr>
I ge a js error 'object expected' when I click off the password2 field...
and while I'm at it, if the alert comes up I'd like to pull focus to the
password2 field and clear it's value, something like:
<script language="javascript">
function CheckValues() {
if (document.register.password1.value !=
document.register.password2.value) {
alert("The values for \'password\' and \'confirm pasword\' are
different.
Please make sure both fields are the same.");
return false;
document.register.password2.focus;
document.register.password2.value = '';
} else {
return true;
}
}
</script>
if you want to test it, go to http://test.artsoutheast.co.uk
choose 'register now'
choose a town from the drop-down
and you'll get the form I'm wibbling about ;-)
any help appreciared.
TIA
Ian W
Ian Westbrook,
FutureDream Media Limited,
(W): www.futuredream.net
(E): [EMAIL PROTECTED]
(T): +44 (0) 1303 258 985
(M): 07939 510 812
This message may contain information which is legally privileged and/or
confidential. If you are not the intended recipient, you are hereby notified
that any unauthorised disclosure, copying, distribution or use of this
information is strictly prohibited. Such notification notwithstanding any
comments, opinions, information or conclusions expressed in this message are
those of the originator, not of FutureDream Media Ltd, unless otherwise
explicitly and independently indicated by an authorised representative of
FutureDream Media Ltd.
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]