select of select box will select multiple in another box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • palmiere

    #1

    select of select box will select multiple in another box

    Im trying to do the following:

    I have 2 select boxes, both are pre populated with data. The first box
    is a single select box, the 2nd is a multiple select box. Depending on
    the 1st selection, I want to have multiple values in the second select
    box highlighted.

    ie
    box 1
    <select name=type>
    <option> warm colors
    <option> cool colors
    <option> shades of grey
    </select>

    box 2
    <select name=colors multiple>
    <option> red
    <option> orange
    <option> yellow
    <option> blue
    <option> green
    </select>

    If the user would select warm colors from box 1, red, orange and
    yellow would be highlighted for them. Any suggestions? Thanks.
  • Erwin Moller

    #2
    Re: select of select box will select multiple in another box

    palmiere wrote:
    [color=blue]
    > Im trying to do the following:
    >
    > I have 2 select boxes, both are pre populated with data. The first box
    > is a single select box, the 2nd is a multiple select box. Depending on
    > the 1st selection, I want to have multiple values in the second select
    > box highlighted.
    >
    > ie
    > box 1
    > <select name=type>
    > <option> warm colors
    > <option> cool colors
    > <option> shades of grey
    > </select>
    >
    > box 2
    > <select name=colors multiple>
    > <option> red
    > <option> orange
    > <option> yellow
    > <option> blue
    > <option> green
    > </select>
    >
    > If the user would select warm colors from box 1, red, orange and
    > yellow would be highlighted for them. Any suggestions? Thanks.[/color]


    Hi, it is actually not difficult.
    Here is a piece of old examplecode to get you going:

    <html>
    <head>
    <title> titel </title>
    <script type="text/javascript">

    function setme(num)
    {
    document.forms. aform.fruit.sel ectedIndex = num;
    }

    </script>
    </head>

    <body>

    <form name="aform">

    <select name="fruit">
    <option value="bananas" >bananas</option>
    <option value="kokos">k okos</option>
    <option value="apple">a pple</option>
    </select>
    <input type=submit >
    </form>

    <p>
    <a href="javascrip t:setme(0);">se t bananas</a><p>
    <a href="javascrip t:setme(1);">se t kokos</a><p>
    <a href="javascrip t:setme(2);">se t apple</a><p>
    </body>
    </html>



    Regards,
    Erwin Moller

    Comment

    Working...