I posted a link to the Three Selects Related tag.  It does the same 
thing that you are looking for.  Perhaps you might try downloading it 
and reading through the code of the tag to find the answer to your question.

Hatton

Ian Vaughan wrote:

>Hi
>
>I think you will find it is more difficult then you may think...
>
>I am using the sample code from webtricks.com.  Their default is two
>selects - what I need to find out is where to add javascript and coldfusion
>to build arrays for the third select box
>
>This is the actual code for two selects, need to find out how to build in
>the extra logic to get three selects working on the same approach as below?
>
>This is where I am having trouble.... and would appreciate some help please
>
><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="GetStates" group="State">
>   // Create the array
>   StateArray#StateCode# = new Array();
>   <cfset i = 0>
>   // Populate the array
>   <cfoutput>
>      <cfset i = i + 1>
>      StateArray#StateCode#[#i#] = #AreaCode#;
>   </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>
>
>
>
>
>
>----- Original Message -----
>From: "Robertson-Ravo, Neil (RX)" <[EMAIL PROTECTED]>
>To: "CF-Talk" <[EMAIL PROTECTED]>
>Sent: Thursday, December 05, 2002 2:08 PM
>Subject: RE: Please help me achieve this with CF and Javascrip please
>
>
>  
>
>>It really shouldn't be difficult at all... what problems are you running
>>into? have you got some semi-working code at all?
>>
>>-----Original Message-----
>>From: Ian Vaughan [mailto:[EMAIL PROTECTED]]
>>Sent: 05 December 2002 14:08
>>To: CF-Talk
>>Subject: Re: Please help me achieve this with CF and Javascrip please
>>
>>
>>Just wondering if anybody else could shed some light on if this can
>>    
>>
>actually
>  
>
>>be accomplished??
>>
>>There must be a way of adding a third select dynamically to this code? I
>>have been looking into it all morning with no success as of yet, but would
>>be interesting to hear views from the experienced professional coldfusion
>>and javascript developers on the list
>>
>>
>>----- Original Message -----
>>From: "Bob Haroche" <[EMAIL PROTECTED]>
>>To: "CF-Talk" <[EMAIL PROTECTED]>
>>Sent: Wednesday, December 04, 2002 4:23 PM
>>Subject: Re: Please help me achieve this with CF and Coldfusion please
>>
>>
>>    
>>
>>>>I am using a piece of code for 2 related selects shown below. I would
>>>>        
>>>>
>>like
>>    
>>
>>>>to add a third select field and have this generated dynamically from a
>>>>database using Coldfusion like the other two selects shown below.
>>>>        
>>>>
>>>Nate Weiss has a custom tag called Three Related Selects or something
>>>similar on the MM Exchange.
>>>
>>>Re the script you posted, I've used that one to create a modified
>>>      
>>>
>version
>  
>
>>of
>>    
>>
>>>three related selects. In my case, I needed both selects 2 and 3
>>>      
>>>
>>(populated
>>    
>>
>>>with the same values) to change when select 1 was chosen. In my case
>>>      
>>>
>>select
>>    
>>
>>>3 wasn't controlled by select 2 but was also controlled by select 1. The
>>>situation was that user chooses "Animal Type" (select 1) and then
>>>      
>>>
>selects
>  
>
>>>"Primary Breed" (select 2) and "Secondary Breed" (select 3). Let me know
>>>      
>>>
>>if
>>    
>>
>>>you're interested in that type of code.
>>>
>>>---------------
>>>Regards,
>>>Bob Haroche
>>>O n P o i n t  S o l u t i o n s
>>>www.OnPointSolutions.com
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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