?
Solved

I Need a procedure to dinamically populate 3 drop-down menus depending on the selection of the first drop-down menu

Posted on 2004-08-11
6
Medium Priority
?
168 Views
Last Modified: 2013-12-24
I have 3 drop-down menus in a form
Question1  has 3 options. Depending on the answer to question1, question2 will  show 6 to 10 options. Depending on the answer to the question 2,  the third one will show options that will be populated from a db table. Question 3 options MUST come from a table


0
Comment
Question by:gaby22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 1000 total points
ID: 11777697
This code (thanks to TallerMike) should get you on the right track...

<script src="http://mike.kingery.com/inc/js/filterSelect.js"></script>
<script language="JavaScript">
auto_enable_disable = true;
</script>

<form name="carForm">

<select name="company" onchange="filterSelect(model,this)">
<option value=""></option>
<option value="ford">Ford</option>
<option value="chevy">Chevy</option>
<option value="audi">Audi</option>
</select>

<select name="model" onchange="filterSelect(edition,this)" disabled="true">
<option value="" filter=""></option>
<option value="pickup" filter="ford">Ford Pickup</option>
<option value="van" filter="ford">Vans</option>
<option value="caprice" filter="chevy">Caprice</option>
<option value="corvette" filter="chevy">Corvette</option>
<option value="A4" filter="audi">A4</option>
<option value="A6" filter="audi">A6</option>
</select>

<select name="edition" disabled="true">
<option value="" filter=""></option>
<option value="F150" filter="pickup">F150</option>
<option value="F250" filter="pickup">F250</option>
<option value="F350" filter="pickup">F350</option>
<option value="CClassic" filter="caprice">Caprice Classic</option>
<option value="COnv" filter="corvette">Corvette Convertible</option>
<option value="CZ6" filter="corvette">Corvette Z6</option>
<option value="Wagon" filter="caprice">Caprice Wagon</option>
<option value="Cvan" filter="van">Cargo Van</option>
<option value="A627" filter="A6">A6 2.7L</option>
<option value="A643" filter="A6">A6 4.3L</option>
<option value="A427" filter="A4">A4 2.7L</option>
<option value="A430" filter="A4">A4 3.0L</option>
</select>
</form>
0
 

Author Comment

by:gaby22
ID: 11778390
It does what I want but as i said the last option needs to be populated from a query like
<cfquery datasource="db" name=opts">
select * from table where field_name = '#question2_value#'
</cfquery>

<select>
<cfouput query= opts>
<option value="#opts.fieldname#">#opt.fieldname#</option>
</cfoutput>
 </select>

I don't know how to get the question2_value to run the query
0
 

Expert Comment

by:speshal
ID: 11778717
Dan has set it up correctly.  There's no way to populate the third select field without doing a page post.  What you'll need to do is select ALL records in your query.

<cfquery datasource="db" name="opts">
SELECT id, value, field_name
  FROM table
<cfquery>

<select name="edition" disabled="true">
  <cfoutput query="db">
    <option value="#opts.id#" filter="#opts.field_name#">#opts.value#</option>
  </cfoutput>
</select>

opts.fieldname is equal to your value for the second dropdown.
and your table should have the basic structure of
id   value   field_name
1    F150   pickup
2    F250   pickup
3    A627   A6
4    A643   A6
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 1000 total points
ID: 11778726
Try the 3 related selects tag available fro free from macromedia cold fusion exchange :

http://www.macromedia.com/cfusion/exchange/index.cfm#view=sn105&viewName=Exchange%20Search&loc=en_us

Enter "Related Selects" and choose cold fusion from the drop down menu.

It shows how to make each dependent on eahc other and how to populate from a query

0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question