mardi 4 août 2015

notEmpty validator not working for a select control

I am trying to throw an error when a user doesn't pick anything other than the default in a select box.

I am using the html 5 attribute

data-bv-notempty="true"

My current code is

  <select id="mySelect" class="selectpicker form-control" data-bv-notempty="true" style="color: #777;">
     <option value="">1st option</option>
 </select>

I believe that if the user picks the option which has value="", an error will flag (incited from http://ift.tt/1IDAKCq)

I would like the select box to appear like this when they do select the defaulted option

What the end goal should be

What am I doing wrong?

Thanks

Aucun commentaire:

Enregistrer un commentaire