Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dependable drop-down? 1

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
US
My client has a table called "locations" that has four columns (LID, country, state, city).

What I'd like to do from the UI is have 3 drop-down boxes; the user select a country (drop-down 1), depending on his selection the state drop-down gets populated, and when the user selects a state the city drop-down populated. How can I do this in CF? I'm going to running a query first that returns all country, state and city.

Now the kicker countries other then USA and Canada don't have states so in that case when those counties are selected only the city drop-drop gets populated.

Any ideas?

____________________________________
Just Imagine.
 
GUJUm0deL, THANKYOU THANKYOU THANKYOU!! It works exactly as I wanted and is so clean! I was trying to adapt the code you listed above on Dec 11 and I just couldn't get the 2nd dropdown to work. You're FAQ is awesome!

Thanks also for the fast reply!

mamabird
 
GUJUm0deL, one more question about your code - if I want to display a text value but want the value passed in the form to be an ID how do I incorporate those into the three dropdowns?

Thanks!
mamabird
 
Refreshing the page might not be user friendly but using a js solution only can be user hostile. Is this an intranet? If so maybe you can get away with a js only solution. If this is a public site you need to use both server and client side. Or perhaps Flash - but that is still going to be an issue with .7 percent of your users.

Cheers,

Bluetone
 
If I hear you right, you want to do something like:

<option value="1">textual value 1</option>
<option value="2">textual value 2</option>
<option value="3">textual value 3</option>
<option value="4">textual value 4</option>
<option value="5">textual value 5</option>

If so, i'll look at this at home tonight and see if I can help out any further.

____________________________________
Just Imagine.
 
Yes GUJUm0deL that's what I want to do. I tried messing around with it myself but only managing to mess it up and I'm not sure what I broke or didn't break. This is an intranet with about 150 users so we want to do this direction. Some of our forms have many many fields and if a user has them filled out and the form refreshed itself there will be unhappy tech support calls! :)
Thanks!
 
Ok, I played around with this and don't see a viable solution for passing the ID as the value and a textual value as the display.

The code works by looping over the query and using that value specified in aryLocation[#Variables.JSLoop#] tag as both the display value and the value passed as a form var.


____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top