House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Checkbox Input Type Condition

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Steve LaBadie
04/03/2008 04:13 PM

I have a form which in part includes the option of checking a workshop (4 different workshops in all) and a place for the number of attendees. Workshop 1:<input type="checkbox" name="wrkshp" value="Workshop 1" /> Attendees:<input type="text" name="att1" /> Workshop 2:<input type="checkbox" name="wrkshp" value="Workshop 2" /> Attendees:<input type="text" name="att2" /> Workshop 3:<input type="checkbox" name="wrkshp" value="Workshop 3" /> Attendees:<input type="text" name="att3" /> Workshop 4:<input type="checkbox" name="wrkshp" value="Workshop 4" /> Attendees:<input type="text" name="att4" /> I am using a cfloop for the wrkshp selected on my action page, but I also want to display the number of attendees based on which workshop was checked. Since the checkboxes are grouped (same name) I am not sure how to identify the selected value in my conditional expression. Workshop: <cfloop list="#form.wrkshp#" index="w">#w#</cfloop> Attendee: <cfif IsDefined("form.wrkshp") AND form.wrkshp NEQ""> <cfoutput>#form.att1#</cfoutput> <cfelseif> <cfoutput>#form.att2#</cfoutput> <cfelseif> <cfoutput>#form.att3#</cfoutput> <cfelse> <cfoutput>#form.att4#</cfoutput> </cfif> Steve LaBadie, Web Manager East Stroudsburg University 200 Prospect St. East Stroudsburg, Pa 18301 570-422-3999 slabadie@po-box.esu.edu <mailto:slabadie@po-box.esu.edu> http://www.esu.edu <http://www.esu.edu>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Kris Jones
04/03/2008 04:29 PM

You need to check and see if the Workshop name is in the form.wrkshp value. Use listfindnocase() method: You wouldn't want to use cfelseif because a user could check more than one wrkshp checkbox, right? <cfif isdefined("form.wrkshp")>     <cfif listfindnocase(form.wrkshp,"Workshop 1") gt 0>          <cfoutput>#form.att1#</cfoutput>     </cfif>     <cfif listfindnocase(form.wrkshp,"Workshop 2") gt 0>           <cfoutput>#form.att2#</cfoutput>     </cfif>     . . . </cfif> HTH, Kris ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference