Skip to main content
Inspiring
December 11, 2008
Question

Create drop down based on drop down

  • December 11, 2008
  • 3 replies
  • 510 views
Lets say I have a table that contains 50 states and I query and produce a dynamic drop down list. Is it possible to create another dynamic drop down list based on a selection from the first drop down list (both have to be on the same form) ?

For example, if I select TX from the states drop down, then the second drop down, which is city, should show me a list of cities in TX, as a drop down. If I select NY from states, then the city would show cities in NY as a drop down, etc. The city dropdown should change dynamically based on the state drop down selection.

How can this be done ?
    This topic has been closed for replies.

    3 replies

    Inspiring
    December 12, 2008
    Also,

    You can use DOM/WDDX stuff to acheieve this.
    December 11, 2008
    Well, you can do this with CF for sure, but because you'd probably want to populate the second select list "onChange" this will mean JavaScript would be required (or you could have a submit button I suppose). But, if you're gonna use JavaScript, then you may aswell use AJAX which would be nicer.

    Search Google for help on specifics. It's called "chained selects" or "related selects". I think there also used to be a custom tag for it out there somewhere too.

    Good luck,
    Mikey,
    Inspiring
    December 11, 2008
    The concept is called related selects and there is a lot of information available. However, it might not be the best idea in this case, depending on how many cities you are talking about.