|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi,
I want to show one of two select list menus depending on the selection made on two citeria form a select list. e.g The queries statements are: <cfquery name="q_regiontown" datasource="bluegrass_property"> SELECT townregionsearch, townorregionid FROM tbTownRegion ORDER BY townregionsearch ASC </cfquery> <cfquery name="q_region" datasource="bluegrass_property"> SELECT DISTINCT region FROM dbo.tbregion ORDER BY region ASC </cfquery> <cfquery name="q_town" datasource="bluegrass_property"> SELECT DISTINCT townname FROM dbo.tbtown ORDER BY townname ASC </cfquery> This list/menu has two options (search by town or region )and depending on which one the user selects will show either a region or a town select list/menu's (see below): <tr> <td>Town or Region </td> <td><select name="TownRegion" id="Townregion"> <option value="value">Town or region</option> <cfoutput query="q_regiontown"> <option value="#q_regiontown.townorregionid#">#q_regiontown.townregionsearch#</option> </cfoutput> </select></td> </tr> will select one of these two: I need a <cfif> here? <td> </td> <td><select name="select"> <option value="value">Region</option> <cfoutput query="q_region"> <option value="#q_region.region#">#q_region.region#</option> </cfoutput> </select></td> and a <cfelseif> here? <td>Town</td> <td><select name="ListTown" id="select2"> <option value="value">Please select a town</option> <cfoutput query="q_town"> <option value="#q_town.townname#">#q_town.townname#</option> </cfoutput> </select></td> Hope you can help Cheers peter |
|
#2
|
|||
|
|||
|
Is this on 2 pages, or are you talking about doing this on a single page?
If you want to do it on 2 pages, this is easy to do with CF. Just pass the choice from the first form to the target page, and based on that choice to display one or the other second dropdown box. If you want to do this on a single page, this isn't the realm of CF but of Javascript. You'll need to write event handlers to populate the second drop down box based on the selection the user makes in the first box. You can write your own, search the web for some premade solutions (www.javascripts.com might help) or even try out QForms (www.pengoworks.com). |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Selecting a List menu |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|