dynamic multiple selects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • d.schulz81@gmx.net

    dynamic multiple selects

    Holas,

    I want to do the following:
    If one entry in multiple select "domain" is selected, i want to change
    the content in dropdown "typ" dynamically according to the selected
    domain.

    If more than one entries in domain are selected, i want the dropdown
    typ to disappear

    here the javaScriptCode that causes an "typ has no properties" -Error:


    <script language="Javas cript">
    <!-- Start
    function updateType()
    {
    domain = document.forms["frm"].elements["txtDomain"];
    typ = document.forms["frm"].elements["txtType"];

    typ.options.len gth = 0; // DropDown Menü entleeren

    if (domain.options
    [domain.selected Index].
    value == "Email")
    {
    typ.options[0] = new Option("Softwar e");
    typ.options[1] = new Option("Anbiete r");
    }
    else if (domain.options
    [domain.selected Index].
    value == "Internet")
    {
    typ.options[0] = new Option("Interne tzugang");
    typ.options[1] = new Option("Webseit en erstellen");
    }
    }
    // Ende -->
    </script>



    here the multi selects:

    <tr class="color1">
    <td>Domain: (Mehrfachauswah l mit <br/>gedrückter Strg-Taste
    möglich)</TD>
    <td colspan="2">
    <SELECT size=3 name="txtDomain[]" multiple="multi ple"
    onchange="updat eType()">
    <OPTION value=0 selected> alle </OPTION>
    <?
    while ($arrDomain = mysql_fetch_arr ay($rsDomain))
    {
    echo("<OPTION value=".$arrDom ain["ID"]."> ".$arrDomai n["Name"]."
    </OPTION>");
    }
    ?>
    </SELECT>
    </TD>
    </TR>



    <tr class="color1">
    <td>Type: (Mehrfachauswah l mit <br/>gedrückter Strg-Taste
    möglich)</TD>
    <td colspan="2">
    <SELECT size=3 name="txtType[]" multiple="multi ple">
    <OPTION value=0 selected> alle </OPTION>
    </SELECT>
    </TD>
    </TR>

    I would appreciate any help..
    thank you very much

    Dennis

  • Mick White

    #2
    Re: dynamic multiple selects

    d.schulz81@gmx. net wrote:[color=blue]
    > Holas,
    >
    > I want to do the following:
    > If one entry in multiple select "domain" is selected, i want to change
    > the content in dropdown "typ" dynamically according to the selected
    > domain.
    >
    > If more than one entries in domain are selected, i want the dropdown
    > typ to disappear
    >
    > here the javaScriptCode that causes an "typ has no properties" -Error:
    >
    >
    > <script language="Javas cript">
    > <!-- Start
    > function updateType()
    > {
    > domain = document.forms["frm"].elements["txtDomain"];[/color]

    domain = document.forms["frm"].elements["txtDomain[]"];

    [color=blue]
    > typ = document.forms["frm"].elements["txtType"];[/color]

    typ = document.forms["frm"].elements["txtType[]"];

    No?

    Mick[color=blue]
    >[/color]
    [snip]

    Comment

    Working...