Groups | Blog | Home
all groups > coldfusion flash integration > may 2005 >

coldfusion flash integration : Dynamic Field Names in a Flash Form


OldNapkin
5/13/2005 12:00:00 AM
How can I build a Flash Form with dynamic field names based on query results?
For example, lets say I want to make a list of names with a checkbox beside
them. The names are in a database. It works in HTML, but evidently I don't
understand how Flash interprets CF variable.
How can I change this code to make it work? Thanks!

<cfquery datasource="datasource" name="get_stuff">
SELECT id, company FROM myTable
</cfquery>
<cfform format="Flash">
<cfoutput query="get_stuff">
<cfinput type="Checkbox" name="company" value="#id#" label="#company#">
</cfoutput>
</cfform>

hollyjones
5/13/2005 12:00:00 AM
The problem is that all items in a flash form must have a unique name. I ran
into this in a similar project. I ended up using something like the example
below, where I included the index in the name of the checkbox field. On the
form submission I wrote some code to take care of the dash and the index number.


<cfform format="Flash">
<cfloop from="1" to="get_stuff.recordCount" index="idx">
<cfinput type="Checkbox" name="company#idx#-" value="#id#"
label="#company#">
</cfloop>
</cfform>
AddThis Social Bookmark Button