I was more suggesting that you could learn from the code in the
ThreeSelects tag and apply it to what you have now. I initially looked
at slimming the code down and then decided it would be good to go stock.
I also have a small amount of HTML to put between the selects for my use.
As for the driving query, you don't need three separate tables. You
need better SQL in your select for the query. What's the query that
you're using for driving your selects?
Hatton
Ian Vaughan wrote:
>I have used the three select related tag and agreed it works quite well,
>nate has done a good job.
>
>However there is a lot of code bloat with that tag i.e. there is a lot of
>javascript product that you do not use, and the control you have over the
>page is not as great as if the webtricks version had 3 selects as you can
>see exactly what is going on.
>
>Also with the three selects tag you need 3 seperate tables to speicfy each
>select value, where as the other approach will let you get away with 1 table
>which is what I have to work with.
>
>
>----- Original Message -----
>From: "Hatton Humphrey" <[EMAIL PROTECTED]>
>To: "CF-Talk" <[EMAIL PROTECTED]>
>Sent: Thursday, December 05, 2002 3:28 PM
>Subject: Re: Please help me achieve this with CF and Javascrip please
>
>
>
>
>>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].va
>>
>>
>l
>
>
>>>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