Ah cool... I did not know there was a CFQueryParam with type LIST. That is awesome!
I had visions of looping and parsing lists etc... much easier your way! -----Original Message----- From: Casey Dougall [mailto:ca...@uberwebsitesolutions.com] Sent: Friday, April 17, 2009 10:04 AM To: cf-talk Subject: Re: dynamic form and converting list of form variables On Fri, Apr 17, 2009 at 9:57 AM, Chad Gray <cg...@careyweb.com> wrote: > > I have a form that has a bunch of checkbox fields that are dynamically > created from a database. > > I need to take the fields selected and evaluate them and convert them to a > list that I can use in a SQL query. > > Here is what is coming in to the action page: > > FIELDNAMES=PICTCATEGORYNAME1,PICTCATEGORYNAME3,PICTCATEGORYNAME5 > PICTCATEGORYNAME1=designed it myself > PICTCATEGORYNAME3=clothes > PICTCATEGORYNAME5=accessories > > I need to take this data and get it into my SQLs IN function. > > SELECT * > FROM profiles > WHERE pictcategoryname IN ('designed it myself','clothes','accessories') > > Are there any magical CF functions that can deliver this? The form fields > will be changing according to what the user selected. > > If you use the same name for each check box, they will be in a list, so instead of PICTCATEGORYNAME12345 etc, you just name all check boxes PICTCATEGORYNAME. Then it would already be in that list as needed, WHERE pictcategoryname IN (<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.PICTCATEGORYNAME#" list="yes">) Casey ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321734 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4