Fix account form validation and disable submit button is form is invalid.

This commit is contained in:
Alexis Lahouze 2017-07-04 21:54:21 +02:00
parent fe2355a405
commit 0fa2f06a0e

View File

@ -19,7 +19,7 @@
<h3 class="modal-title" id="modal-title">{{ $ctrl.title() }}</h3>
</div>
<form class="form-horizontal simple-form" novalidate ng-submit="$ctrl.ok()">
<form name="form" class="form-horizontal simple-form" novalidate ng-submit="$ctrl.ok()">
<div class="modal-body" id="modal-body">
<div class="form-group" ng-class="{ 'has-error' : form.name.$invalid && !form.name.$pristine }">
<label class="col-sm-4 control-label" for="name">Account name</label>
@ -56,7 +56,7 @@
</div>
<div class="modal-footer">
<input class="btn btn-primary" type="submit" ng-click="$ctrl.ok()"/>
<input class="btn btn-primary" type="submit" ng-click="$ctrl.ok()" ng-disabled="form.$invalid"/>
<button class="btn btn-default" type="button" ng-click="$ctrl.cancel()">
Annuler
</button>