Well, I see one syntactical error. The OR below should be ||
if(cnt_chk >= 14 OR cnt_chk <=12) // SHould read if(cnt_chk >= 14 ||
cnt_chk <=12)
Don't know if that solves everything...
Alec
> -----Original Message-----
> From: PEREZ, RICHARD RINGO (SBCSI) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 12:33 PM
> To: CF-Talk
> Subject: Javascirpt problem on CF
>
>
> This is my code with Javascript can you pelase help me figure
> out what's
> wrong? i know that Javascript is a client side while CF is
> server side. Can
> you please help me out to figure what changes do i need to
> do on my code?
>
> What i'm trying to do on my code is they need to click on the
> checkbox and i
> will count how many checkboxes they already clicked on and
> they should have
> a max of 13 clicks.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title></title>
>
> <link href="../Styles/css.css" rel="stylesheet" type="text/css">
>
> <script language="JavaScript">
> var cnt_chk = 0;
> var cnt_sel = 0;
>
> function validate(obj){
> len = parseFloat(obj.clen.value)
>
> cnt_chk = 0
> for(i=1; i<=len; i++)
> {
> byVal = eval("obj.o" + i + ".checked")
> if(byVal == true)
> {
> cnt_chk++
> }
> }
>
> if(cnt_chk == 0)
> {
> alert("You must select a Candidate");
> return false;
> }
>
> if(cnt_chk >= 14 OR cnt_chk <=12)
> {
> alert("You must select exactly 13 Candidates");
> return false;
> }
> }
>
> function fnCountNatin(obj){
> cnt_sel = 0;
> len = parseFloat(document.frmVote.clen.value)
>
> for(i=1; i<=len; i++)
> {
> byVal = eval("document.frmVote.o" + i +
> ".checked")
> if(byVal == true)
> {
> cnt_sel++
> }
> }
> document.frmvote.total_sel.value = cnt_sel++
> }
>
> function fnTotal(obj){
> alert("number of Candidates selected: " +
> obj.value + " ")
> return false;
> }
> </script>
>
> </head>
>
> <body VLINK="#990099" LINK="Blue" TEXT="Black"
> ALINK="#7204C3" leftmargin=0
> topmargin=0>
>
>
>
> <cfquery name="GetC" datasource="xxx" dbtype="ODBC">
> Select CID, CFirstName, CLastName, CNickName, CParty
> >From Candidate
> </cfquery>
>
>
> <form action="Update/add_vote_form.cfm" method="post" name="frmVote"
> onSubmit="return validate(this)">
>
> Unang Hakbang: Email <input type="Text" name="Email"
> required="No" size="30"
> maxlength="50">
>
> <P>
> Pangalawang Hakbang:<br>
> <table align="center">
> <tr>
> <td></td>
> <td>Mga Kandidato</td>
> <td>Party</td>
> </tr>
> <cfoutput query="GetC">
> <tr>
> <td><input type="Checkbox" name="o#GetC.CID#" value="#GetC.CID#"
> onClick="fnCountNatin(this)"></td>
> <td>#GetC.CFirstName# #GetC.CLastName# #GetC.CNickName#</td>
> <td>#GetC.CParty#</td>
> </tr>
> </cfoutput>
> </table>
> <p>
> Pangatlong Hakbang:<br>
> <input type="hidden" name="clen" value="34">
> Number of Candidates selected:
> <input type="text" name="total_sel" maxlength="2" size="3" value="0"
> onclick="return fnTotal(this)" onkeypress="javascript:return
> fnTotal(this)"><br>
> <input type="submit" name="Submit" value=" Vote! ">
> </form>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists