Thanks Dave. No luck.
The form is not remembering the checkboxes. <cfparam name="FORM.allst" default="no"> <cfloop query="allstates"> <cfinput type="checkbox" name="allst" checked="#form.allst#" value="#allstates.statename#"> #allstates.statename#<br /> </cfloop> >Barry, > >The reason is that since you are using a 'regular' <input> tag instead of >the '<cfinput', the values are not getting evaluated by ColdFusion (the >#statename# is not getting replaced with the actual value from the table). >You need to do one of the following: > ><cfoutput query="allstates"> > <input type="checkbox" name="allst" value="#allstates.statename#"> >#allstates.statename#<br /> ></cfoutput> > >OR > ><cfloop query="allstates"> > <cfinput type="checkbox" name="allst" value="#allstates.statename#"> >#allstates.statename#<br /> ></cfloop> > >The first one replaces your cfloop with a cfoutput, so that anything with >pound signs around it inside the opening and closing <cfoutput> tags will >get replaced with the actual value. > >The second one leaves your <cfloop> tag, but replaces the HTML <input> tag >with the ColdFusion <cfinput> tag. Anything with pound signs inside a CF >tag doesn't need to have <cfoutput> around it because CF will automatically >replace it with the actual value. > >One more thing. When you are referencing variables in ColdFusion it's a >good practice to always 'scope' your variable. In other words, by just >saying #statename# a programmer cannot tell where that variable is actually >coming from. By using #allstates.statename# the programmer now knows to >look for 'allstates' and will find at the top of your code that it is a >query. It can also save you headaches later on because if you don't scope a >variable, CF automatically assumes the variable scope for you (in a specific >order - can't remember it right off the bat) but if you had a form.statename >variable AND allstates.statename and you just reference a variable as >#statename# CF will assume you meant form.statename and you'll probably get >undesirable results. > >Hope this helps. > >Dave >OK Dave. > >After playing around all day with the checkbox "allst" with a cfloop, I'm >confused with coldfusion again. > >http://code-bin.homedns.org/330 > >The last code does not work for query checkboxes :( > >Thanks, > >Barry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4642 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
