Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 dynamic linked drop down menus error

Status
Not open for further replies.

dunskii

Programmer
Sep 14, 2001
107
AU
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
 
as far as your error on line 7
Looks like
Where Market_ID = #Market.Market_ID[x]#
should read
Where Market_ID = #qGetMarket.Market_ID[x]#

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Ah Hah.... fixed the typo now I get this....

I don't even know what it is talking about

Element QGETZONE is undefined in a Java object of type class [Ljava.lang.String; referenced as

The error occurred in : line 1

-1 : Unable to display error's location in a CFML template.


now i wish i had done a bit more js

thanks again,

AD
 
hmmm.

I see what you're doing here is prefixing your queryName with "qGetZone" so you end up with "qGetZoneVALUEOFMARKET_ID" and that should probably work but try this instead.

<cfset queryName = "qGetZone" & qGetMarket.Market_ID[x]>

<CFQUERY name="#queryName#">

now i wish i had done a bit more js
this has nothing to do with javaScript CF is translated by a Java engine, the error occured in there

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
i tried that and got the same error...

I'm considering using the twoselect custom tag though it would be nice to understand how it works instead of just using it

ahhh the joys,

thanks again for your help

AD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top