Jquery validate and bootstrap - select the field choose multiple options

advertisements

I am trying to make a select field validated with jquery data attributes such that you must pick 3 fields. Here is my attempt but it doesnt work

 <div class="form-group">
              <label class="col-sm-3 control-label">Flowers</label>
              <div class="col-sm-9">
                <select id="flowers" name="flowers"  class="form-control" size="5" multiple="multiple" data-rule-required="true" data-msg-required="comment field is required." data-rule-min="3" data-msg-min="pick 3">
                  <option value="lily">Lily</option>
                  <option value="jasmine">Jasmine</option>
                  <option value="daisy">Daisy</option>
                  <option value="iris">Iris</option>
                  <option value="rose">Rose</option>
                </select>
                <label class="error" for="flowers"></label>
              </div>
            </div><!-- form-group -->

Any advice much appreciated

edit: similarly while i'm asking this question I may as well ask if anyone has an example of a regex using data attributes. Thanks :)


I know that maybe you are looking for a native solution with boostrapp. I only used that way, throught bootstrap-multiselect plugin. Take a look maybe helps you.