oops,  maybe I read your post wrong.

If you are looking at setting all the selects to the same option try
something like this:

Don't know how you have your selects named now but if they are in order
like:

MySelect1 OnChange="resetlists(1)"
MySelect2 OnChange="resetlists(2)"
MySelect3 OnChange="resetlists(3)"
...
MySelectLast

because on the last one there are no more below it to change??

<SCRIPT>
        Function resetlists(start){
                Var SelectName = "MySelect" + start;    
                Var next = start-1;
                Var SelectNext = "MySelect" + next;

        While (next < MaxnumSelects){
        
                control = 0;    
                while (control< document.form.[Selectnext].options.length){
                        if
(document.form.[Selectnext].options.[control].value ==
document[formname][SelectName].value){
        
document.dform.Workplans.options[control].selected = true; 
                                 }
                        control++;      
                  }             
                next++;
        }

}

</SCRIPT>



Something like this might work.
Look it over, it's written on the cuff so , will ;o)  have errors
but should get you pointed in a direction, hopefully.
 

-----Original Message-----
From: charlie griefer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 11:53 AM
To: CF-Talk
Subject: Re: -OT- Javascript and combo boxes


the general rule for selecting an option in a combo box is: 

document.formName.selectBoxName.selectedIndex = n 

where n is your number (remember, the first option is 0) 

In your case, i'd guess you want to store the names of your 30 combo boxes 
in an array, and add a function for onchange into each <select>, which loops

over the array, setting eavh value appropriately (which would be 
this.selectedIndex...passed as an argument) :) 

you can contact me off-list if you need any help with it if you'd like. 

charlie 


Thane Sherrington writes: 

> At 10:39 AM 4/1/03 -0600, Chris Montgomery wrote:
>>Howdy Thane, 
>>
>>Tuesday, April 1, 2003, 10:03:33 AM, Thane Sherrington wrote: 
>>
>> > Is it possible to use Javascript to select a choice in a combo box? 
>>
>> > For instance, if I have a form with people listed, and beside each, a 
>> combo
>> > box with all the departments in the company, can I select a department
in
>> > the first combobox, and have the other combo boxes automatically switch
to
>> > that department as well? 
>>
>>Yes. Look for the CF_TwoSelectsRelated custom tag in the Macromedia CF
>>Exchange.
> 
> I don't think this is what I want.   I've got about 30 combo boxes, all 
> with four or five departments.  What I want to do is when I select the 
> first department for the first person, the following boxes change to that 
> department.  Then if I change the department for the second person, I want

> the remaining boxes to change to that. 
> 
> T 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to