View Full Version : Dynamic Lists

05-09-2006, 05:13 PM
Hello all, new member. :D

Here's my situation, and I apologize if it's been discussed already, but I'm not really sure exactly what to search for.

I would like to build a "drill-down" feature on a form. I want to start with a list that contains all 50 states, which are populated from a SQL table. When a state is selected I want to query a list of users in another SQL table, and show the cities of all users in that state. Then from the city selection I want to finally narrow down to just the users in the selected city. I know how to do this by continually submitting forms and passing a variable, but how can I do this on the same form and refreshing each list "on the fly?" Thanks for any help!

05-11-2006, 01:53 PM
Could anyone perhaps just point me in the right direction? I would really appreciate any guidance.

05-11-2006, 01:59 PM

you can do this using a number of different technologies like javascript or PHP and ASP

i would go down the PHP route then you can make other aspects of your site dynamic

05-11-2006, 02:09 PM
Oops, I guess I left out one critical point. My application is in ColdFusion, so I'm assuming anything I could do with PHP I can do with ColdFusion. Problem is, I don't know where to start within the ColdFusion environment to find how to do what I want.

I actually started building this with JavaScript, which I know on a novice level, but upon each refresh to populate the next box it was reloading the entire page and not just refreshing the lists. *Sigh* Mabye I'll just dig around in my ColdFusion book some more.

05-11-2006, 02:17 PM
or you could drop coldfusion and try PHP

then i will be able to help

I dont know that much about coldfusion.. sorry

05-11-2006, 02:22 PM
Sorry, this is for an existing application that is built entirely in ColdFusion, so I'm stuck with it. Thanks anyway for your willingness to help! :D

05-11-2006, 02:24 PM
if i use pseudo code then maybe that will help...

do you know how to query a database using a SELECT in coldfusion???

05-11-2006, 02:34 PM
Yes. I know how to populate the lists from a datasource, but I need a way to do it all on one page. If I can find a way to refresh the second list after selecting an option in the first without doing a full page reload I will be golden. I know I could build an array with my options in a JavaScript function, but the values will be changing frequently so I don't think that's the way to go.

05-11-2006, 03:22 PM

2 dropdowns in page 1

[dropdown1] [dropdown2]

when you first go into page1 dropdown1 is populated with values

when you change the option in dropdown1 (using an onChange submit()) which submits the same page back to itsself passing the var from the first dropdown.

this then is sent to query a second recordset which populates the second dropdown

05-11-2006, 07:18 PM
(using an onChange submit()) which submits the same page back to itsself passing the var from the first dropdown.

D'oh! I should have been using a submit instead of doing a reload. It worked! Much thanks. :D