Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    double combo box in tables

    I have one combo box in one cell of a table. I want it so that if you select the last option; then the options in another combo box in another cell changes. I have this so far but I keep getting the error: "document.number1.select_2.options" is null or not and object.

    Here is what I have so far:

    "<"Script Language = "Javascript">


    var num_of_cats = 4; // This is the number of instructions, including the first, blank, category.

    var option_array = new Array(num_of_cats);

    option_array[0] = new Array("N/A",
    "N/A");

    option_array[1] = new Array("N/A",
    "N/A");

    option_array[2] = new Array("N/A",
    "N/A");

    option_array[3] = new Array("-- Select Return --",
    "Small Biz",
    "Corporate");


    function switch_select()
    {
    {
    for (loop = document.number1.select_2.options.length-1; loop > 0; loop--)
    {
    document.number1.select_2.options[loop] = null;
    }

    for (loop = 0; loop < option_array[document.number1.select_1.selectedIndex].length; loop++)
    {
    document.number1.select_2.options[loop] = new Option(option_array[document.number1.select_1.selectedIndex][loop]);
    }

    document.number1.select_2.selectedIndex = 0;
    }
    }
    /Script


    Table detail:


    "<"td align="center" >"<"form name='number1'>
    "<"font face="arial" size="2">
    "<"select name='select_1' size="1" onChange="switch_select();">
    "<"option>Please select an instruction
    "<"option>Call
    "<"option>Click
    "<"option>Return
    "<"/select>

    "<"/form>
    "<"/td>
    "<"td>
    "<"form name='number1'>
    "<"select name='select_2' size="1">
    "<"option >N/A

    "<"/select>

    "<"/form>

    "<"/td>

    Probably something silly I am missing.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Delaware, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well first thing i see right off is that the forms are named the same thing. you might either want it on one form or rename one of the forms.

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did try having the form tag after the body tag. The same combo boxes are repeated on the page. Like this image:

    [IMG]Combo Boxes[/IMG]

  • #4
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    image is not posting for some reason, sorry.
    Attached Thumbnails Attached Thumbnails double combo box in tables-combobox.png  

  • #5
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Had this working for a second and then tried to do the same thing to the other sets. I had done so many variations that I forgot what I had done. I then tried to do a Shift Z and watch for it but now it does not work at all. Getting closer, I hope.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •