Ok, I've got this code working to a point, but can't generate the third drop
down box, plus, when the second selection is made, and the page reloads, the
first box clears (not carrying the url across).
Any chance you could have a poke around with this and maybe point out where
I might be going wrong? Meanwhile I'll keep playing around and see what I
can come up with.
Thanks for the help.
<!--- store the selected Main_Group variable variable after the first select boxes submits itself --->
<cfif isDefined('url.manufacturerid')>
<cfset url.manufacturerid = url.manufacturerid>
</cfif>
<!--- test if staement--->
<cfif isDefined('url.modelid')>
<cfset url.modelid = url.manufacturerid>
</cfif>
<cfif isDefined('url.specid')>
<cfset url.specid = url.specid>
</cfif>
<!---end of test if statement--->
<cfoutput>
<form name="DropDown" method="post">
<!--- query DB for the first drop down list --->
<cfquery name="get_Manufacturer" datasource="quote-system">
SELECT *
FROM manufacturer_table
</cfquery>
<!--- first drop down list --->
<!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection --->
<select name="select_Manufacturer" required="yes" onchange="window.open(this.options[this.selectedIndex].value,'_self')">
<option>Select Manufacturer</option>
<!--- dynamically populate the first drop down list based on the get_Main_Group query --->
<!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads --->
<cfloop query="get_Manufacturer">
<option value="new.cfm?manufacturerid=#get_Manufacturer.manufacturer_ID#&manu_value=#get_Manufacturer.number#.html" <cfif isDefined('url.manufacturerid')><cfif url.manufacturerid eq "#cost#">selected</cfif></cfif>>#manufacturer_ID#</option>
</cfloop>
</select>
<p>
<!--- if the first selection has been made, display the second drop down list with the appropriate results --->
<cfif isDefined('url.manufacturerid')>
<!--- query DB for second drop down list, based on the selected item from the first list --->
<cfquery name="get_Model" datasource="quote-system">
SELECT *
FROM model_table
WHERE sub_manufacturer_ID = <cfqueryparam value="#url.manufacturerid#" cfsqltype="cf_sql_varchar">
</cfquery>
<!--- second drop down list --->
<select name="select_Model" required="yes" onchange="window.open(this.options[this.selectedIndex].value,'_self')">
<option>Select Model</option>
<!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
<cfloop query="get_Model">
<option value="#new.cfm?modelid=#get_Model.manufacturer_ID#&manu_value=#get_Model.number#.html#" <cfif isDefined('url.modelid')><cfif url.modelid eq "#cost#">selected</cfif></cfif>>#model_ID#</option>
</cfloop>
</select>
</cfif>
<p>
<!---start of third testing drop down--->
<cfif isDefined('url.modelid')>
<cfquery name="get_Spec" datasource="quote-system">
SELECT *
FROM spec_table
WHERE sub_model_ID = <cfqueryparam value="#url.modelid#" cfsqltype="cf_sql_varchar">
</cfquery>
<select name="select_Spec" required="yes" onchange="window.open(this.options[this.selectedIndex].value,'_self')">
<option>Select Spec</option>
<!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
<cfloop query="get_Spec">
<option value="#new.cfm?specid=#get_Spec.model_ID#&manu_value=#get_Spec.number#.html#" <cfif isDefined('url.specid')><cfif url.specid eq "#cost#">selected</cfif></cfif>>#spec_ID#</option>
</cfloop>
</select>
</cfif>
<!---end of test third drop down box --->
</form>
</cfoutput>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69:





by: SidFishesPosted on 2008-10-13 at 07:50:16ID: 22702883
using the form submit in this instance probably will cause issue when you actually want to submit the form, try using the window.open
rid')>
this basically reloads the page and uses url variables to set your values since it's a url string you can add multiple params
use the url values for your isdefined
<cfif isDefined('url.manufacture
Select allOpen in new window