Hello all,
I am in the process of creating 2 drop down menus. The first displays the main categories once select the second will show the corresponding sub categories.
I was reading which was a great help, though I now get an error --> Element MARKET_ID is undefined in MARKET
The error occurred in Add_Area_Form2.cfm: line 7
5 :
6 : <CFLOOP index="x" From = "1" to = "#qGetMarket.recordcount#">
7 : <CFQUERY name="qGetZone#qGetMarket.Market_ID[x]#" datasource="Y_Business">
8 : Select Zone_ID, Name, Market_ID
9 : From Zone
I'll also be creating 3 linked drop down menus but thought I'd get this one working before I moved on.
Here's the code I'm using
<CFLOOP index="x" From = "1" to = "#qGetMarket.recordcount#">
<CFQUERY name="qGetZone#qGetMarket.Market_ID[x]#" datasource="Y_Business">
Select Zone_ID, Name, Market_ID
From Zone
Where Market_ID = #Market.Market_ID[x]#
</CFQUERY>
</CFLOOP>
<SCRIPT Language="JavaScript">
<!--
function updatesel(form)
{
form.Zone_ID.length = 1;
form.Zone_ID.selectedIndex = 0;
choice = form.Market_ID.options[form.Market_ID.selectedIndex].value;
<CFLOOP Index="count" from="1" to="#qGetMarket.recordcount#">
<CFOUTPUT>
if (choice == "#qGetMarket.Market_ID[count]#")
{
<CFLOOP index="x" From="1" to="#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.recordcount')#">
(form.Zone_ID.length)++; form.Zone_ID.options[form.Zone_ID.length - 1].text = "#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.qGetZone[x]')#";
form.Zone_ID.options[form.Zone_ID.length - 1].value = "#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.Zone_ID[x]')#";
</CFLOOP>
}
</CFOUTPUT>
</CFLOOP>
}
//-->
</script>
Cheers,
D
I am in the process of creating 2 drop down menus. The first displays the main categories once select the second will show the corresponding sub categories.
I was reading which was a great help, though I now get an error --> Element MARKET_ID is undefined in MARKET
The error occurred in Add_Area_Form2.cfm: line 7
5 :
6 : <CFLOOP index="x" From = "1" to = "#qGetMarket.recordcount#">
7 : <CFQUERY name="qGetZone#qGetMarket.Market_ID[x]#" datasource="Y_Business">
8 : Select Zone_ID, Name, Market_ID
9 : From Zone
I'll also be creating 3 linked drop down menus but thought I'd get this one working before I moved on.
Here's the code I'm using
<CFLOOP index="x" From = "1" to = "#qGetMarket.recordcount#">
<CFQUERY name="qGetZone#qGetMarket.Market_ID[x]#" datasource="Y_Business">
Select Zone_ID, Name, Market_ID
From Zone
Where Market_ID = #Market.Market_ID[x]#
</CFQUERY>
</CFLOOP>
<SCRIPT Language="JavaScript">
<!--
function updatesel(form)
{
form.Zone_ID.length = 1;
form.Zone_ID.selectedIndex = 0;
choice = form.Market_ID.options[form.Market_ID.selectedIndex].value;
<CFLOOP Index="count" from="1" to="#qGetMarket.recordcount#">
<CFOUTPUT>
if (choice == "#qGetMarket.Market_ID[count]#")
{
<CFLOOP index="x" From="1" to="#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.recordcount')#">
(form.Zone_ID.length)++; form.Zone_ID.options[form.Zone_ID.length - 1].text = "#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.qGetZone[x]')#";
form.Zone_ID.options[form.Zone_ID.length - 1].value = "#Evaluate('qGetZone#qGetMarket.Market_ID[count]#.Zone_ID[x]')#";
</CFLOOP>
}
</CFOUTPUT>
</CFLOOP>
}
//-->
</script>
Cheers,
D