Copy link to clipboard
Copied
I've got to fields on called supplier and the second one called product.
Both fileds can be populated form the database.
However. If the first field is selected ( Supplier) how
can i have the secon field ( product) automatically populated with only
those products applicable form the choosen supplier.
And the other way around.
The script i'm having is below.
<cfquery name="rs_supplier" datasource="Reach">
SELECT distinct "Supplier"
FROM ProdSupplier
ORDER BY Supplier ASC
</cfquery>
<cfquery name="rs_ProdFam" datasource="Reach">
SELECT distinct "ProdFam"
FROM ProdSupplier
ORDER BY ProdFam ASC
</cfquery>
<html>
<head>
-->
</style></head>
<body>
<form name="form1" method="post" action="report1.cfm?">
<p> </p>
<table width="89%" border="0">
<tr>
<td height="29"> </td>
<td><span class="style1">REACH Documents </span></td>
<td> </td>
</tr>
<tr>
<td height="29"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="29">Supplier</td>
<td><select name="Supplier" size="1" >
<cfoutput query="rs_supplier">
<option value="#rs_supplier.Supplier#"> #rs_supplier.Supplier#</option>
</cfoutput>
</select></td>
<td> </td>
</tr>
<tr>
<td height="29">Product Family </td>
<td><select name="ProdFam" size="1" id="ProdFam" >
<cfoutput query="rs_ProdFam">
<option value="#rs_ProdFam.ProdFam#"> #rs_ProdFam.ProdFam#</option>
</cfoutput>
</select></td>
<td> </td>
</tr>
<tr>
<td height="29"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
Copy link to clipboard
Copied
What you are attempting is often called related selects. There is more than one way to do it. Here is an example of one of those methods. http://www.pathcom.com/~bracuk/code/RelatedSelects.htm