> The application I'm working on originally used POST methods
> for form submissions. On SELECT TYPE="MULTIPLE" fields, the
> output was handled very nicely and the data was posted as
> "somefield=value1,value2,value3" if multiple items were
> selected. This made dealing with the values very simple for
> many reasons.
>
> However, for various reasons, I have had to convert
> everything over to use the GET method for form submission.
> On the same SELECT TYPE="MULTIPLE" field, the data is now
> sent as "somefield=value1&somefield=value2&somefield=value3"
>
> Is there a simple way to "convert" the data that looks like
> "somefield=value1&somefield=value2&somefield=value3" into
> values that look like "somefield=value1,value2,value3"? Do I
> loop through it treating SOMEFIELD as a collection? Is there
> an easier or more straightforward way of doing this? I'm
> using CF5 Ent.
Well, I would have thought that URL.somefield is still
"value1,value2,value3" but that's apparently not true. Hmph.
You could treat the string as a list with & as the delimiter and use a loop.
<cfset newstring="">
<cfloop list="#CGI.QUERYSTRING#" index="i" delimiter="&">
<cfif ListFirst(i,"=") EQ "somefield">
<cfset newstring=ListAppend(newstring,ListLast(i,"="),",")>
</cfif>
</cfloop>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4