Results 1 to 2 of 2

Thread: need: modified chained selects script

  1. #1
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need: modified chained selects script

    I've checked through most of the search results for DD's chained selects script, and I haven't found the solution to my problem.

    Scripts that are similar to what I'm going for:
    - DD's chained selects script
    - Modified chained selects
    - Another chained selects script

    Problem:
    I need a form that allows me to modify multiple drop-down boxes based on the choice of one box. For example, let's say in Box1, you make Choice A. I need Box2 to list different choices based on your choice in Box1, and I also need Box3 ( or 4, or 5, etc. ) to list different choices ( completely different from Box2 ) based on what choice you make in Box1.
    For example, taking DD's car example: Let's say you choose "Toyota". Your choice of "Toyota" ends up listing different choices in the "select vehicle type" box. Let's say there's a third box, like car color, which is independent of the second box ("vehicle type") but is dependent on the choice made in the first box ("maker type").
    So instead of being directly chained together, it's more like a tree.

    ( I tried searching for some kind of javascript tree form, but haven't found anything. )


    Another question, slightly related: is there a way for the drop-down menus to be populated from external files? E.g. the drop-down menu is populated from a .txt that contains a list of all drop-down menu items, or something. It would also be awesome if I could do this with textboxes. ( Either if I could populate a text box from an external file, or using something similar to a chained selects script. )
    ETA: I should add - I'm not sure if this second thing can be done with Javascript, so I'm open to pretty much any alternatives.
    Last edited by karorom; 01-18-2009 at 10:46 PM.

  2. #2
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Me too looking for the similar functionality

    Based on change of One Select box: would like to have two or more select boxes content changed.

    I'm able to achieve this through simple script(straight forward one).
    But the back-button/Refresh action collapses it and make it hassle for the end-user.

    Can someone throw light on this?
    ********************************
    <select name="SeriesNo" size="1" onChange="redirect(this.options.selectedIndex)">
    <option value="" selected>---Select Platform------</option>
    <option>320</option>
    <option>1400</option>

    </select>

    <br>

    <td height=35 colspan=1 width=30%> Ingress:
    <td height=35 colspan=1>Line Module&nbsp;&nbsp;
    <select name="InLM" size="1" onChange="redirect_In(this.options.selectedIndex)">
    <option value=" " selected> DISABLED</option>
    </select>

    <td height=35 colspan=1>IOA Type&nbsp;&nbsp;

    <select name="InIOA" size="1" >
    <option value=" " selected> DISABLED</option>
    </select>

    <br>

    <td height=35 colspan=1 width=30%> Egress:
    <td height=35 colspan=1>Line Module&nbsp;&nbsp;
    <select name="EgLM" size="1" onChange="redirect_Eg(this.options.selectedIndex)">
    <option value=" " selected> DISABLED </option>

    </select>

    <td height=35 colspan=1>IOA Type&nbsp;&nbsp;
    <select name="EgIOA" size="1" >
    <option value=" " selected> DISABLED </option>
    </select>

    <br>
    <script>
    var groups=document.entry_form.SeriesNo.options.length
    var group=new Array(groups)
    for (i=0; i<groups; i++)
    group[i]=new Array()

    group[0][0]=new Option("---Select2---"," ");


    /* For Platform 320 */
    group[1][0] =new Option("Select_LineModType","");
    group[1][1] =new Option("LM10","LM10");
    group[1][2] =new Option("LM10CR","LM10CR");
    group[1][3] =new Option("LM10S","LM10S");
    group[1][4] =new Option("LM10U","LM10U");
    group[1][5] =new Option("LM4","LM4");
    group[1][6] =new Option("SI","SI");
    /* For Platform 1400 */
    group[2][0] =new Option("Select_LineModType","");
    group[2][1] =new Option("COC3/COC12","COC3/COC12");
    group[2][2] =new Option("CT3-12","CT3-12");
    group[2][3] =new Option("FE-8","FE-8");
    group[2][4] =new Option("GE-2","GE-2");
    group[2][5] =new Option("GE-HDE-8","GE-HDE-8");
    group[2][6] =new Option("GE/FE","GE/FE");
    group[2][7] =new Option("OC3/OC12-ATM","OC3/OC12-ATM");
    group[2][8] =new Option("OC3/OC12-POS","OC3/OC12-POS");
    group[2][9] =new Option("OC3/STM1-8","OC3/STM1-8");
    group[2][10] =new Option("SERVICEMODULE","SERVICEMODULE");
    group[2][11] =new Option("SI","SI");
    group[2][12] =new Option("T3","T3");

    function redirect(x){
    /* For Ingress column */
    var tempIn=document.entry_form.InLM

    for (m=tempIn.options.length-1;m>0;m--)
    tempIn.options[m]=null
    for (i=0;i<group[x].length;i++){
    tempIn.options[i]=new Option(group[x][i].text,group[x][i].value)
    }
    tempIn.options[0].selected=true
    redirect_In(0)

    /* For Egress column */
    var tempEg=document.entry_form.EgLM
    for (m=tempEg.options.length-1;m>0;m--)
    tempEg.options[m]=null
    for (i=0;i<group[x].length;i++){
    tempEg.options[i]=new Option(group[x][i].text,group[x][i].value)
    }
    tempEg.options[0].selected=true
    redirect_Eg(0)
    }

    var secondGroups=document.entry_form.InLM.options.length
    var secondGroup=new Array(groups)
    for (i=0; i<groups; i++) {
    secondGroup[i]=new Array(group[i].length)
    for (j=0; j<group[i].length; j++) {
    secondGroup[i][j]=new Array() }}

    secondGroup[0][0][0]=new Option("---Select 3---"," ");

    secondGroup[1][0][0] =new Option("---Select 3---"," ");
    secondGroup[1][1][0] =new Option("Select_IOA","");
    secondGroup[1][1][1] =new Option("10GE","10GE");
    secondGroup[1][1][2] =new Option("ATM","ATM");
    secondGroup[1][1][3] =new Option("FE","FE");
    secondGroup[1][1][4] =new Option("GE","GE");
    secondGroup[1][1][5] =new Option("POS","POS");
    secondGroup[1][2][0] =new Option("Select_IOA","");
    secondGroup[1][2][1] =new Option("10GE","10GE");
    secondGroup[1][2][2] =new Option("ATM","ATM");
    secondGroup[1][2][3] =new Option("FE","FE");
    secondGroup[1][2][4] =new Option("GE","GE");
    secondGroup[1][2][5] =new Option("POS","POS");
    secondGroup[1][3][0] =new Option("Select_IOA","");
    secondGroup[1][3][1] =new Option("10GE","10GE");
    secondGroup[1][3][2] =new Option("ATM","ATM");
    secondGroup[1][3][3] =new Option("FE","FE");
    secondGroup[1][3][4] =new Option("GE","GE");
    secondGroup[1][3][5] =new Option("POS","POS");
    secondGroup[1][4][0] =new Option("Select_IOA","");
    secondGroup[1][4][1] =new Option("10GE","10GE");
    secondGroup[1][4][2] =new Option("ATM","ATM");
    secondGroup[1][4][3] =new Option("FE","FE");
    secondGroup[1][4][4] =new Option("GE","GE");
    secondGroup[1][4][5] =new Option("POS","POS");
    secondGroup[1][5][0] =new Option("Select_IOA","");
    secondGroup[1][5][1] =new Option("ATM","ATM");
    secondGroup[1][5][2] =new Option("FE","FE");
    secondGroup[1][5][3] =new Option("GE","GE");
    secondGroup[1][5][4] =new Option("POS","POS");
    secondGroup[1][6][0] =new Option("Select_IOA","");
    secondGroup[1][6][1] =new Option("SI","SI");
    secondGroup[2][0][0] =new Option("---Select 3---"," ");
    secondGroup[2][1][0] =new Option("Select_IOA","");
    secondGroup[2][1][1] =new Option("ATM","ATM");
    secondGroup[2][1][2] =new Option("FE","FE");
    secondGroup[2][1][3] =new Option("GE","GE");
    secondGroup[2][1][4] =new Option("POS","POS");
    secondGroup[2][2][0] =new Option("Select_IOA","");
    secondGroup[2][2][1] =new Option("ATM","ATM");
    secondGroup[2][2][2] =new Option("FE","FE");
    secondGroup[2][2][3] =new Option("GE","GE");
    secondGroup[2][2][4] =new Option("POS","POS");
    secondGroup[2][3][0] =new Option("Select_IOA","");
    secondGroup[2][3][1] =new Option("ATM","ATM");
    secondGroup[2][3][2] =new Option("FE","FE");
    secondGroup[2][3][3] =new Option("GE","GE");
    secondGroup[2][3][4] =new Option("POS","POS");
    secondGroup[2][4][0] =new Option("Select_IOA","");
    secondGroup[2][4][1] =new Option("ATM","ATM");
    secondGroup[2][4][2] =new Option("FE","FE");
    secondGroup[2][4][3] =new Option("GE","GE");
    secondGroup[2][4][4] =new Option("POS","POS");
    secondGroup[2][5][0] =new Option("Select_IOA","");
    secondGroup[2][5][1] =new Option("ATM","ATM");
    secondGroup[2][5][2] =new Option("FE","FE");
    secondGroup[2][5][3] =new Option("GE","GE");
    secondGroup[2][5][4] =new Option("POS","POS");
    secondGroup[2][6][0] =new Option("Select_IOA","");
    secondGroup[2][6][1] =new Option("ATM","ATM");
    secondGroup[2][6][2] =new Option("FE","FE");
    secondGroup[2][6][3] =new Option("GE","GE");
    secondGroup[2][6][4] =new Option("POS","POS");
    secondGroup[2][7][0] =new Option("Select_IOA","");
    secondGroup[2][7][1] =new Option("ATM","ATM");
    secondGroup[2][7][2] =new Option("FE","FE");
    secondGroup[2][7][3] =new Option("GE","GE");
    secondGroup[2][7][4] =new Option("POS","POS");
    secondGroup[2][8][0] =new Option("Select_IOA","");
    secondGroup[2][8][1] =new Option("ATM","ATM");
    secondGroup[2][8][2] =new Option("FE","FE");
    secondGroup[2][8][3] =new Option("GE","GE");
    secondGroup[2][8][4] =new Option("POS","POS");
    secondGroup[2][9][0] =new Option("Select_IOA","");
    secondGroup[2][9][1] =new Option("ATM","ATM");
    secondGroup[2][9][2] =new Option("FE","FE");
    secondGroup[2][9][3] =new Option("GE","GE");
    secondGroup[2][9][4] =new Option("POS","POS");
    secondGroup[2][10][0] =new Option("Select_IOA","");
    secondGroup[2][10][1] =new Option("ATM","ATM");
    secondGroup[2][10][2] =new Option("FE","FE");
    secondGroup[2][10][3] =new Option("GE","GE");
    secondGroup[2][10][4] =new Option("POS","POS");
    secondGroup[2][11][0] =new Option("Select_IOA","");
    secondGroup[2][11][1] =new Option("SI","SI");
    secondGroup[2][12][0] =new Option("Select_IOA","");
    secondGroup[2][12][1] =new Option("ATM","ATM");
    secondGroup[2][12][2] =new Option("FE","FE");
    secondGroup[2][12][3] =new Option("GE","GE");
    secondGroup[2][12][4] =new Option("POS","POS");

    var tempInIOA=document.entry_form.InIOA
    function redirect_In(y){
    for (m=tempInIOA.options.length-1;m>0;m--)
    tempInIOA.options[m]=null
    for (i=0;i<secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y].length;i++){
    tempInIOA.options[i]=new Option(secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y][i].text,secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y][i].value)
    }
    tempInIOA.options[0].selected=true
    }

    var tempEgIOA=document.entry_form.EgIOA
    function redirect_Eg(y){
    for (m=tempEgIOA.options.length-1;m>0;m--)
    tempEgIOA.options[m]=null
    for (i=0;i<secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y].length;i++){
    tempEgIOA.options[i]=new Option(secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y][i].text,secondGroup[document.entry_form.SeriesNo.options.selectedIndex][y][i].value)
    }
    tempEgIOA.options[0].selected=true
    }
    //-->
    </script>

Bookmarks

Posting Permissions

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