Change the form like so:

                <CFOUTPUT QUERY="MetList">
                        <TR>
                                <TD><INPUT TYPE="checkbox" NAME="MetCheck" 
VALUE="#Met_ID#"></TD>
                                <TD>#Met_ID#</TD>
                                <TD>#FirstName# #LastName#</TD>
                        </TR>
                </CFOUTPUT>

        Notice that I changed te name so that all the checkbox will have the same 
name.  This will cause
        one form field to be posted called form.MetCheck which will contain a list of 
all the IDs that
        were checked.  To get a count simply use listLen(form.MetCheck).  Note that if 
none of the 
        fields were checked, form.MetCheck will not exist.  I handle this by using 
cfparam to 
        initialize the variable with an empty string.

        Craig


> -----Original Message-----
> From: Ann Harrell [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, May 23, 2001 2:12 PM
> To:   CF-Talk
> Subject:      Count check boxes?
> 
> I have a list of 67 names each with a unique ID. I've given each check box a
> corresponding ID. I just want to count the number of boxes checked and
> output that number for now.
> 
> If you want to know what a wobber is, go to www.wob-l.org at your own risk.
> 
> Thanks!
> 
> 
> <CFQUERY NAME="MetList" DATASOURCE="wobbersmet">
> SELECT      Met_ID, FirstName, LastName
> FROM         Wobbers
> ORDER BY Wobbers.Met_ID
> </CFQUERY>
> 
> <FORM ACTION="MetListAction.cfm" METHOD="POST">
> <TABLE WIDTH="45%">
>       <TR>
>               <TH ALIGN="LEFT">Met</TH>
>               <TH ALIGN="LEFT">ID</TH>
>               <TH ALIGN="LEFT">Name</TH>
>       </TR>
>       <CFOUTPUT QUERY="MetList">
>               <TR>
>                       <TD><INPUT TYPE="checkbox" NAME="MetCheck#Met_ID#" 
>VALUE=""></TD>
>                       <TD>#Met_ID#</TD>
>                       <TD>#FirstName# #LastName#</TD>
>               </TR>
>       </CFOUTPUT>
> <TR>
>       <TD COLSPAN="2"><INPUT TYPE="Submit" NAME="SubmitButton" VALUE="Count
> Wobbers Met"></TD>
> </TR>
> </table>
> 
> Ann Harrell
> Mind like a steel trap..
> Rusty and illegal in 37 states.
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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