What's not working, JS, CF? What does the source look like in the browser?

Some tips for you... you don't need the ToString() calls in CF and it's
Javascript not Java (big difference).

Adrian

-----Original Message-----
From: Jessica Kennedy [mailto:[EMAIL PROTECTED]
Sent: 09 September 2008 18:09
To: CF-Talk
Subject: dynamic js field verification


Hi, I am working on a page where an admin would enter an id number for one
or more of a list of people.  as it is important that the numbers match, I
am making a verification field to check the numbers match.  All fine and
dandy, however I would like to have js check this before the form is
submitted.  The code I have is not working, I am guessing it has to do with
naming the function, but I am pretty much a complete newbie to java.  how
can I make this work?

<cfoutput query="rscards">
<!---Convert int to string for java--->
<cfset chk="chk"&tostring(rscards.dealerid)>
<cfset javaint=tostring(rscards.dealerid)>
<cfset java="java"&tostring(rscards.dealerid)>

<cfinput type="text" name="#javaint#" id="#javaint#" value=""
onvalidate="#java#" /> <cfinput type="text" name="#chk#" value="" id="#chk#"
message="oops" onvalidate="#java#" />#rscards.first_name#
#rscards.last_name# #rscards.dealerid#<br />

<script type="text/javascript">
function #java#(form) {
if(form.#javaint#.value == form.#chk#.value) {
return true;
}
else {
alert("Error: #rscards.first_name# #rscards.last_name#'s info does not
match.");
form.#chk#.focus();
return false;
}
}
</script>

</cfoutput>

<cfinput type="submit" value="Submit" name="submit" />
</cfform>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312292
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to