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
159 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

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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…
A short film showing how OnPage and Connectwise integration works.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 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

17 Experts available now in Live!

Get 1:1 Help Now