Skip to main content
Participating Frequently
February 6, 2007
Question

Drop down boxes

  • February 6, 2007
  • 3 replies
  • 450 views
I have 2 database tables - one contains a list of categories and one contains a list of specific items. I want to have two drop down boxes. When you select the category from the first, it should automatically fill the second with all of the items from that category. Right now we are using JS to do this, but I was wondering if it could be done with CF? This is on a form that calls itself, so it is important to have the previously selected category already in the drop down box when the form calls itself. (It calls itself if you select "edit" rather than "submit")

There are over a hundred items in the second list, so a series of if statements would be impractical.
This topic has been closed for replies.

3 replies

Known Participant
February 23, 2007
Take a look at the custom tag cf_twoselectsrelated. I think that this gives you the functionality that you want. Just search for it on the adobe site. Thanks.

Chris
February 7, 2007
cf is server side. unless you want to refresh the page (make a trip to the server) when the first dropdown changes, it's not a CF thing.

it can become a CF thing if you use AJAX. you'd still be using JS to make the XMLHTTPRequest call...but in that call you'd use CF on the server to send a recordset back down to the client.

i've used JSMX ( http://www.lalabird.com) in the past... but jQuery is getting a whole lotta love in the CF community right now, and as soon as my plate clears off a bit, i'll be checking into using that myself.
Inspiring
February 7, 2007
Yes, you just have to pass the selected catagory along then run a query to pull the new info and then use that query to fill in the drop down list.

http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Tags91.htm