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
158 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
6 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 250 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 250 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now