Hi

I am using my  oracle database table to populate 2 related selects, however
when I am running the page I am recieving the following error....

Error Occurred While Processing Request
Error Diagnostic Information
Loop error

The error occurred while processing an element with a general identifier of
(CFOUTPUT), occupying document position (19:1) to (19:41).

Any ideas from my code of any solutions to resolve the errors I am getting
??

Thanks


<!--- Select the states and area codes. --->


<CFQUERY name="query1" datasource="intranetv8">
SELECT
* from category_menu
where parent_level= catno
ORDER BY cat_desc

</CFQUERY>




<script language = "JavaScript">
<!--
// For each state, create an array to hold the area codes.
// Each state array will be identified by the two-character state
abbreviation
<cfoutput query="query1" group="catdesc">
   // Create the array
   StateArray#catno# = new Array();
   <cfset i = 0>
   // Populate the array
   <cfoutput>
      <cfset i = i + 1>
      StateArray#catno#[#i#] = #parent_level#;
   </cfoutput>
</cfoutput>

// Function to populate the area codes for the state selected
function PopulateAreaCode() {
   // Only process the function if the first item is not selected.
   if (document.StateForm.StateCode.selectedIndex != 0) {
      // Find the state abbreviation
      var ThisState =
document.StateForm.StateCode[document.StateForm.StateCode.selectedIndex].val
ue;
      // Set the length of the arecode drop down equal to the length of the
state's array
      document.StateForm.AreaCode.length = eval("StateArray" + ThisState +
".length");
      // Put 'Select' as the first option in the area code drop-down
      document.StateForm.AreaCode[0].value = "";
      document.StateForm.AreaCode[0].text = "Select";
      document.StateForm.AreaCode[0].selected = true;
      // Loop through the state's array and populate the area code drop
down.
      for (i=1; i<eval("StateArray" + ThisState + ".length"); i++) {
         document.StateForm.AreaCode[i].value = eval("StateArray" +
ThisState + "[i]");
         document.StateForm.AreaCode[i].text = eval("StateArray" + ThisState
+ "[i]");
      }
   }
}
//-->
</script>

<p>A very popular question is how to have the selection of an item in one
drop-down
box automatically populate another drop-down box without refreshing the
page.  The answer
is JavaScript!  Using arrays, you can have your second select box be
dependent on the
first one.  Keep in mind, though, that all the data loads when the page
loads
and lengthy recordsets could mean a longer download time.</p>

<p>The following example will show each area code for a state.  When you
select a different
state, the contents of the Area Code box will automatically change as
well.</p>

<form name="StateForm">
<p>
<table border="0">
   <tr>
      <td><b>State</b></td>
      <td><b>Area Code</b></td>
   </tr>
   <tr>
      <td>
         <select name="StateCode" onChange="PopulateAreaCode()">
            <option value="0">Select State
            <cfoutput query="query1" group="cat_desc">
               <option value="#catno#">#cat_desc#
            </cfoutput>
         </select>
      </td>
   <td>
      <select name="StateCode" width="70" style="width:150" size="1">
         <option value="0">Select Area Code
         <cfoutput query="query1">
            <option value="#catno#">#cat_desc#
         </cfoutput>
      </select>
   </td>
   </tr>
</table>
</p>
</form>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to