|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Checkbox Input Type Condition
I have a form which in part includes the option of checking a workshopSteve LaBadie 04/03/08 04:13 P You need to check and see if the Workshop name is in the form.wrkshpKris Jones 04/03/08 04:29 P 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> 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 -----
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||