Sorry for maybe asking beginners questions & sorry for my English, but I cant seem to get this work (I didn't develop this).
I have 3 select dropdown boxes in Coldfusion. The first dropdown State is populated by a database onload:
<cfquery name="qState" datasource="#Variables.fw.Config.DSN#">
SELECT * from refState WHERE State = '#url.BindID#' AND status = 'Active' order by ldesc
</cfquery>
<select name="State">
<option value="" <cfif isDefined("url.PrevID") and #url.PrevID# EQ "">selected</cfif>></option>
<cfoutput query="qState">
<option value="#qState.State#" <cfif isDefined("url.PrevID") and #url.PrevID# EQ #qState.State#>selected</cfif>>#qState.Ldesc#</option>
</cfoutput>
</select>
It then passes the selected value to the second dropdown which is City:
<cfdiv id="City" bind="url:index.cfm?section=public&action=City&txtReff=#txtReff#&BindStateID={State}&PrevCityID=#txtCity#">
Query to get city under the state:
<!--- loop to fix the state, returns the correct value even though i hav limited knowledge on this --->
<cfset num = 0>
<cfloop index="i" list="#url.BindStateID#" delimiters=",">
<cfset num = #num# + 1>
<cfif #num# EQ 2>
<cfset p = #i#>
</cfif>
</cfloop>
<!--- then the query to get cities under the state --->
<cfquery name="qCity" datasource="#Variables.fw.Config.DSN#">
SELECT * from refCity WHERE State = '#p#' AND status = 'Active' order by ldesc
</cfquery
>
And finally displays the city to select
<select name="City">
<option value="" <cfif isDefined("url.PrevCityID") and #url.PrevCityID# EQ "">selected</cfif>></option>
<cfoutput query="qCity">
<option value="#qCity.City#" <cfif isDefined("url.PrevCityID") and #url.PrevCityID# EQ #qCity.City#>selected</cfif>>#qCity.Ldesc#</option>
</cfoutput>
</select>
The problem is this only works for IE6, 7 and 8. It does not work on Chrome, IE 9 and above and firefox.
Any help would be much appreciated. Thank u