Skip to main content
October 31, 2009
Question

Multiple dropdowns

  • October 31, 2009
  • 1 reply
  • 584 views

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

??

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    October 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>

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

    BKBK
    Community Expert
    Community Expert
    October 31, 2009

    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.