Your problem is that you have to remove the items in the second select list 
first then add new items with the correct values. The person that said the 
options object is read only is correct, I misunderstood what they meant, in 
Netscape you cannot overwrite the values, you have to remove the options 
object and insert a new one.

Here is some code that does what you are trying to do, this was done for a 
project I worked on so you need to adapt it for you purposes


function checkSubmit(frmObj)
        {


                if (document.forms[frmObj].categories.options.selectedIndex == -1)
                {
                        alert("Please select at least one category.");
                }
                else if (document.forms[frmObj].defaultCategory.options.selectedIndex 
== 
-1) //|| (document.forms[frmObj].defaultCategory.options.selectedIndex == 
0))
                {
                        alert("Please select a default category.");
                }
                else
                {
                        document.forms[frmObj].submit();
                }
        }

        // parent function to determine action to take when click is placed
        function processClick(frmName,sltName,dSltName)
        {
                var frmObj = document.forms[frmName];
                // remove all from the default categories select list
                removeAll(frmObj,dSltName);
                // loop over the categories select list and if they are selected add 
to 
the default list.
                for(var k=0;k<frmObj.elements[sltName].options.length;k++)
                {
                        if (frmObj.elements[sltName].options[k].selected)
                        {
                                addOption(frmObj,sltName,dSltName,k);
                        }
                }
        }

        // adds a option to the default categories select list
        function addOption(frmObj,sltName,dSltName,id)
        {
                var topt = new Option(frmObj.elements[sltName].options[id].text);
                topt.value = frmObj.elements[sltName].options[id].value;
                
frmObj.elements[dSltName].options[frmObj.elements[dSltName].options.length] 
= topt;
        }


        // removes all options from the default categories select list
        function removeAll(frmObj,sltName)
        {
                var lst = frmObj.elements[sltName].options.length;
                for(var i=lst;i>-1;i--)
                {
                        frmObj.elements[sltName].options[i] = null;
                }
        }

HTH

Donnie Bachan
Phone: (718) 217-2883
ICQ#: 28006783
"Nitendo Vinces - By Striving You Shall Conquer"
======================================================================
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.


______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to