2

我有出生日期下拉字段,从中我从下拉列表中选择了月份、日期和年份值。选择它们作为之前显示的错误消息后,它工作正常。我的代码:

                    <div class="form-group form-inline">
                      <span for="">Birthday</span>
                      <div class="row panel-body">
                        <select name="month" id="month" class="custom-select col-xs-4" ng-model="dateOfBirth.month" onchange="call()" required >
                          <option value="">Month</option>
                          <option value="1">Jan</option>
                          <option value="2">Feb
                          <option value="3">Mar</option>
                          <option value="4">Apr</option>
                          <option value="5">May</option>
                          <option value="6">Jun</option>
                          <option value="7">Jul</option>
                          <option value="8">Aug</option>
                          <option value="9">Sep</option>
                          <option value="10">Oct</option>
                          <option value="11">Nov</option>
                          <option value="12">Dec</option>
                        </select>
                        <select name="day" id="day" class="custom-select col-xs-4" ng-model="dateOfBirth.day" onchange="call()" required>
                          <option value="">Day</option>
                        </select>
                        <select name="year" id="year" class="custom-select col-xs-4" ng-model="dateOfBirth.year" onchange="call()" required>
                          <option value="">Year</option>
                        </select>
                      </div>
                      <div ng-show="(frm.month.$touched || frm.day.$touched || frm.year.$touched)">
                        <span style="color:red" ng-show="((frm.month.$touched && frm.month.$error.required) || (frm.day.$touched && frm.day.$error.required) || (frm.year.$touched && frm.year.$error.required))">Date is required</span>
                      </div>
                    </div>  

即使我从下拉列表中选择值也会出错。

在此处输入图像描述

4

0 回答 0