force option from – Sergei Beregov Feb 19 '14 at 18:43

  • 1
    Or use: else { $("form").submit(); } – Sergei Beregov Feb 19 '14 at 18:46
  • 0
    <label>Select Tank:</label><br />
    <select class="text" id="seltank" name="tank">
        <option value="All" selected="selected"> Select Tank </option>
    </select>
    

    in the client side click event of your submit button add some javascript to check the value of your drop down.

    if(document.getElementById("seltank").value == "All")
    {
         //put some code to alert the user or show error
        return false; //this should prevent your post
    }
    

    Similar post is here How do I cancel form submission in submit button onclick event?

    Community
    • 1
    • 1
    kale909
    • 119
    • 1
    • 4
    0

    Here's what I do:

    <select class="text2" name="tank" id="mySelect">
         <option></option>
         <option value="4"> Tank#1 </option>
         <option value="9"> Tank#2 </option>
         <option value="21"> Tank#3 </option>
         <option value="34"> Tank#4 </option>
    </select>
    

    If the user hits submit without making a selection, they will be prompted to select an option automatically. The limitation is that you don't get a pretty little "select an option" placeholder.

    Jacob McKay
    • 2,686
    • 1
    • 18
    • 20