Commit 94498d53 by Daniel Lee

template: fix validation for required selects

Since upgrading to Angular 1.6.1, selects with a default empty option
no longer show a popup with an error on submit. This fix adds an
empty option that is then removed with ng-if. Having the default
option set to null or undefined seems to be the cause of the bug.

The list of changes in 1.6 is here but could not find any obvious
cause for this bug:

https://docs.angularjs.org/guide/migration#migrating-from-1-5-to-1-6
parent 65910db9
......@@ -159,7 +159,9 @@
<div class="gf-form max-width-21">
<span class="gf-form-label width-7">Data source</span>
<div class="gf-form-select-wrapper max-width-14">
<select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required></select>
<select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required>
<option value="" ng-if="false"></option>
</select>
</div>
</div>
<div class="gf-form max-width-21">
......@@ -230,7 +232,9 @@
<div class="gf-form max-width-21">
<span class="gf-form-label width-8">Data source</span>
<div class="gf-form-select-wrapper max-width-14">
<select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required ng-change="validate()"></select>
<select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required ng-change="validate()">
<option value="" ng-if="false"></option>
</select>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment