Link to home
Start Free TrialLog in
Avatar of gaby22
gaby22

asked on

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

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


ASKER CERTIFIED SOLUTION
Avatar of danrosenthal
danrosenthal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gaby22
gaby22

ASKER

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
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial