Copy link to clipboard
Copied
I'm very new to ColdFusion and learning things as I go. I'm wondering how to import an array into a dropdown list. I created the array and the dropdown but can't get it to work properly. I would like to see a quick example.
Please help thanks...
The following is a very simplistic example. Please lookup each tag in the documentation to see how they can be used:
<cfset aOptions = ArrayNew(1)>
<cfset aOptions[1] = "one">
<cfset aOptions[2] = "two">
<cfset aOptions[3] = "three">
<select id="cbdlComboboxDropdownList" name="cbdlComboboxDropdownList">
<cfoutput>
<cfloop array="#aOptions#" index="OptionItem">
<option>#OptionItem#</option>
</cfloop>
</cfoutput>
</select>
Sorry for the formatting issues.
Cheers
Eddie
Copy link to clipboard
Copied
The following is a very simplistic example. Please lookup each tag in the documentation to see how they can be used:
<cfset aOptions = ArrayNew(1)>
<cfset aOptions[1] = "one">
<cfset aOptions[2] = "two">
<cfset aOptions[3] = "three">
<select id="cbdlComboboxDropdownList" name="cbdlComboboxDropdownList">
<cfoutput>
<cfloop array="#aOptions#" index="OptionItem">
<option>#OptionItem#</option>
</cfloop>
</cfoutput>
</select>
Sorry for the formatting issues.
Cheers
Eddie
Copy link to clipboard
Copied
Thank you so much for the example. Worked out perfect.
Copy link to clipboard
Copied
Would you happen to know by any chance how to turn this in a filtering/search form? I have 3 dropdowns I would like to create and then filter the records from the table.