Hi
I have a form of manufacturers and models, i want the models drop down menu to only show the models for the manufacturer which is selected. Does this make sense? I have tried using the cfqueryparam and referring it back to the form, but this is unsuccessful as on the first loading of the page.
Here is my code....hope someone might be able to help... <cfparam name="action" default="">
<cfquery datasource="lvl" name="cars">
Select * from dt_models
</cfquery>
<cfquery datasource="lvl" name="manufacturers">
Select *
from dt_manufacturers
</cfquery>
<cfquery datasource="lvl" name="modelq">
Select model_manufacturer,model_name from dt_models
where model_manufacturer = <cfqueryparam value="#form.manufacturer_id#" cfsqltype="cf_sql_integer">
</cfquery>
<cfoutput>
<cfform action="delivery_action.cfm" method="post">
<table>
<tr><td>Please enter vehicle details:</td></tr>
<!---Field Manufacturer --->
<tr><td>Manufacturer</td><td>
<cfselect query="manufacturers" name="manufact" display="manufacturer_name" value="manufacturer_id"></cfselect>
</td></tr>
<!--Field:Model-->
<tr><td>Model</td><td>
<cfselect query="modelq" display="#model_name#" value="#model_name#" name="model"> </cfselect></td></tr>
<input type="submit" value="Save" class="Submit"> <input type="reset" value="Reset" class="submit">
</td></tr>
</td></tr>
</table>
</cfform>
</cfoutput>
I have a form of manufacturers and models, i want the models drop down menu to only show the models for the manufacturer which is selected. Does this make sense? I have tried using the cfqueryparam and referring it back to the form, but this is unsuccessful as on the first loading of the page.
Here is my code....hope someone might be able to help... <cfparam name="action" default="">
<cfquery datasource="lvl" name="cars">
Select * from dt_models
</cfquery>
<cfquery datasource="lvl" name="manufacturers">
Select *
from dt_manufacturers
</cfquery>
<cfquery datasource="lvl" name="modelq">
Select model_manufacturer,model_name from dt_models
where model_manufacturer = <cfqueryparam value="#form.manufacturer_id#" cfsqltype="cf_sql_integer">
</cfquery>
<cfoutput>
<cfform action="delivery_action.cfm" method="post">
<table>
<tr><td>Please enter vehicle details:</td></tr>
<!---Field Manufacturer --->
<tr><td>Manufacturer</td><td>
<cfselect query="manufacturers" name="manufact" display="manufacturer_name" value="manufacturer_id"></cfselect>
</td></tr>
<!--Field:Model-->
<tr><td>Model</td><td>
<cfselect query="modelq" display="#model_name#" value="#model_name#" name="model"> </cfselect></td></tr>
<input type="submit" value="Save" class="Submit"> <input type="reset" value="Reset" class="submit">
</td></tr>
</td></tr>
</table>
</cfform>
</cfoutput>