I forgot to mention the error that i am getting:

An error has occured on the script... the error says it is expecting 'j'?

-----Original Message-----
From: Hayes, David [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 29, 2001 9:49 AM
To: CF-Talk
Subject: RE: Javascirpt problem on CF


My first suggestion is that you debug your script by putting in alert
statements at various points.

For example,
                        if(byVal == true)
                        {
                                cnt_chk++;
                                alert(cnt_chk);
                        }




-----Original Message-----
From: PEREZ, RICHARD RINGO (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 29, 2001 11:33 AM
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to