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

Multiple dropdowns

Participant ,
Oct 30, 2009 Oct 30, 2009

I read Forta's tute on multiple dropdowns using cf8.  Cool.  Works great.  My question is... How do I make the second dropdown contain a blank row if there isn't a blank row in the dataset that is returned from the cfc?

Example

Dropdown 1: Pick a state (values = Michigan, Pennsylvania, Washington)

User pics Michigan

Dropdown 2: Displays all cities in Michigan without any blank values.

Without inserting blank rows into the db, how can I make the first row of Dropdown 2 a blank selection in case the user does not want to select a city...

??

535
Translate
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
Community Expert ,
Oct 31, 2009 Oct 31, 2009

Just add one option tag for the blank value, and the attribute queryPosition="below" to place the query values below the blank.

<cfselect queryPosition="below" etc.>

<option value="">Select city</option>

</cfselect>

Translate
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
Participant ,
Oct 31, 2009 Oct 31, 2009

Thanks BKBK.  That seems like a more elegant solution than what I came up with.

I ended up doing a UNION where the firs SELECT just returns an empty row.

Translate
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
Community Expert ,
Oct 31, 2009 Oct 31, 2009
LATEST

That seems like a more elegant solution than what I came up with.

I ended up doing a UNION where the firs SELECT just returns an empty row.

Doesn't matter. A solution is a solution, whatever tickles your fancy. For the benefit of those who come after you, just write your solution below, and mark it as the correct answer.

Translate
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