Select multiple items in a dropdown list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nsz
    New Member
    • Jul 2007
    • 1

    Select multiple items in a dropdown list

    Hi,

    How to select multiple items on a menu list.

    I always get the error message from the Java Script even if I did select the items.

    This only happen when using IE7 but when using FireFox, it doesn't happen.

    Any idea how to solve the problem.

    ---------------------------------------------------------------------------

    [HTML]<head>
    <script type="text/javascript">
    function validate_form()
    {
    if ( document.testmu ltiple_form.cfi rst_name.value == "" )
    {
    alert ( "Please select an option!!!." );
    return false;
    }
    else
    {
    return true;
    }
    }
    </script>
    </head>
    <body>
    <form action="testmul tiple.html" onsubmit="retur n validate_form() " method="post">< b>
    .....
    <select name="state" size="07">
    <option></option>
    <option>Succeed </option>
    <option>Nkulule ko</option>
    <option>Zulu</option>
    <option>Hahah a</option>
    <option>Hohoh o</option>
    <option>Heheh e</option>
    </select>

    ....
    <input type="submit" value="Submit">
    </form>[/HTML]

    Kindly help if you can.

    Thanks a lot.
    Last edited by acoder; Jul 17 '07, 11:36 AM. Reason: Code in tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You posted in the Articles section. I have moved it over to the Forums section for you.

    I have also changed the thread title.

    MODERATOR

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Your form doesn't have a name.

      Also, are you trying to validate the select dropdown which has a name of "state"? In your validation code, you're validating something else.

      Comment

      Working...