Drop down menu validation?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gogo82
    New Member
    • Dec 2007
    • 3

    Drop down menu validation?

    Hi,

    I need help with a dropdown menu.

    The deal is that I´ve got 2 menu´s, and I need to be able to pick one cathegory in each menu(menu1 and menu2) and press "submit" to get the info.

    How do I "link" the two dropdowns together?


    This is how I´ve done so far:
    [HTML] <SCRIPT TYPE="text/javascript">
    <SCRIPT TYPE="text/javascript">
    <!--
    function dropdown(mySel)
    {
    var myWin, myVal;
    myVal = mySel.options[mySel.selectedI ndex].value;
    if(myVal)
    {
    if(mySel.form.t arget)myWin = parent[mySel.form.targ et];
    else myWin = window;
    if (! myWin) return true;
    myWin.location = myVal;
    }
    return false;
    }
    //-->
    </SCRIPT>

    ----

    <FORM
    ACTION="../cgi-bin/redirect.pl"
    METHOD=POST onSubmit="retur n dropdown(this.m enu1)"
    TARGET="iframe" >


    <div id="searchmain" >
    <input name="q" value="" size="20" id="searchtext " type="text" alt="q">
    <input name="ca" value="12_s" type="hidden">
    <input name="th" value="1" type="hidden" />




    <SELECT NAME="menu1">
    <option selected>Län</option>
    <option value="iframebi lsalongsverige. htm">Norrbotten </option>
    <option value="iframetu ningsverige.htm ">Västerbot ten</option>
    <option value="">Jämtla nd</option>
    <option value="">Skåne</option>
    <option value="">Blekin ge</option>
    <option value="">Västra Götaland</option>
    </select>



    <SELECT NAME="menu2">
    <option selected>Katego rier</option>
    <option value="iframest ylingsverige.ht m">Styling</option>
    <option value="iframetu ningsverige.htm ">Tuning</option>
    <option value="iframepl atlacksverige.h tm">Plåt, Lack & Bilvård</option>
    <option value="iframelj udsverige.htm"> Ljud & Multimedia</option>
    <option value="iframese rvicesverige.ht m">Fordonsservi ce</option>
    <option value="iframeve rktygreservsver ige.htm">Verkty g & Reservdelar</option>
    <option value="iframebi lsalongsverige. htm">Bilsalonge r</option>

    </select>
    <input name="submit" type=submit value="ok">
    </FORM>
    [/HTML]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    What do you mean by "linking" the two menus?

    You can get the value of a dropdown select element using selObj.value where selObj is the select element.

    Comment

    • Gogo82
      New Member
      • Dec 2007
      • 3

      #3
      Hi,

      With "linking" I meant; 1st meny contains "country", 2nd contains "state" and then a submit button on that.

      I´m a rookie at JS, and I´m having a hard time finding anything useful on the net ...please give me a script-example.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by Gogo82
        With "linking" I meant; 1st meny contains "country", 2nd contains "state" and then a submit button on that.
        Maybe this is what you're looking for.

        Comment

        • Gogo82
          New Member
          • Dec 2007
          • 3

          #5
          Hey, It look like it can be useful... I´ll check it out, after I get some sleep.
          Thanx for now.

          Comment

          Working...