Bootstrap 表单验证不适用于日期的数字字段集

Bootstrap form validation not not working on set of number fields for date

我有这三个日期字段:

<div class="col-xs-12 form-group col-sm-6">
  <div class="row">
    <div class="col-xs-3">
      <input autocomplete="off" class="form-control birth-day" id="dan_rodjenja" name="dan_rodjenja" max="31" min="1" placeholder="DD" required type="number" value="" />
    </div>
    <div class="col-xs-3">
      <input autocomplete="off" class="form-control birth-month" id="mjesec_rodjenja" max="12" min="1" name="mjesec_rodjenja" placeholder="MM" required type="number" value="" />
    </div>
    <div class="col-xs-6">
      <input autocomplete="off" class="form-control birth-year" id="godina_rodjenja" max="2000" min="1910" name="godina_rodjenja" placeholder="GGGG" required type="number" value="" />
    </div>
 </div>  

例如,如果第一个和第二个字段已填满而第三个字段为空,则不会出现错误(没有红色边框)。或者当我将第一个字段留空时,所有三个字段都显示错误。有人可以帮我解决这个问题吗?

我正在使用 bootstrap 验证 http://1000hz.github.io/bootstrap-validator/

div 元素,即 输入元素的直接父元素 和 class .form-control 必须有 class .form-group(如下结构)。

<div class="form-group">
    <input class="form-control" ... />
</div>

因此您的代码如下所示:

<div class="col-xs-12 col-sm-6">
    <div class="row">
        <div class="form-group col-xs-3">
            <input autocomplete="off" class="form-control birth-day" id="dan_rodjenja" name="dan_rodjenja" max="31" min="1" placeholder="DD" required type="number" value="" />
        </div>

        <div class="form-group col-xs-3">
             <input autocomplete="off" class="form-control birth-month" id="mjesec_rodjenja" max="12" min="1" name="mjesec_rodjenja" placeholder="MM" required type="number" value="" />
        </div>

        <div class="form-group col-xs-6">
            <input autocomplete="off" class="form-control birth-year" id="godina_rodjenja" max="2000" min="1910" name="godina_rodjenja" placeholder="GGGG" required type="number" value="" />
        </div>
    </div> 
</div>