Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make the <select> Field Required? [duplicate]

Possible Duplicate:
Can I apply the required attribute to <select> fields in HTML5?

I'm using the html5 contact form from here but I'm having issues trying to make the <select> field required. Everything else works fine, just having trouble with this and the dev hasnt responded when I asked about the field. this is what I have

 <select name="package" id="package" title="Please choose a package" class="required">
    <option value="">------------------</option>
    <option value="basic">Basic</option>
    <option value="plus">Plus</option>
    <option value="premium">Premium</option>
</select>

What am I missing to get this working correctly?

like image 880
Joe Bobby Avatar asked Jan 16 '13 07:01

Joe Bobby


1 Answers

I believe that the top answer to this question is what you're looking for. To quote,

This works for me - Have the first value empty - required works on empty values.

<select required> <option value="">Please select</option> <option value="one">One</option> </select>

like image 60
Brian Hannay Avatar answered Oct 22 '22 09:10

Brian Hannay