• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to import an array into a dropdown list?

Explorer ,
Apr 20, 2015 Apr 20, 2015

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...

Views

529

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Apr 20, 2015 Apr 20, 2015

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

Votes

Translate

Translate
Advocate ,
Apr 20, 2015 Apr 20, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 21, 2015 Apr 21, 2015

Copy link to clipboard

Copied

Thank you so much for the example.  Worked out perfect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 21, 2015 Apr 21, 2015

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation