Require that all form fields marked 'required' are filled out before we allow config validation

This commit is contained in:
Joseph Schorr 2015-01-08 15:58:35 -05:00
parent bfd273d16f
commit 0a82f669ae
3 changed files with 33 additions and 15 deletions

View file

@ -127,6 +127,16 @@ angular.module("core-config-setup", ['angularFileUpload'])
}, ApiService.errorDisplay('Could not validate configuration. Please report this error.'));
};
$scope.checkValidateAndSave = function() {
if ($scope.configform.$valid) {
$scope.validateAndSave();
return;
}
$element.find("input.ng-invalid:first")[0].scrollIntoView();
$element.find("input.ng-invalid:first").focus();
};
$scope.validateAndSave = function() {
$scope.savingConfiguration = false;
$scope.validating = $scope.getServices($scope.config);
@ -593,9 +603,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
}, true);
$scope.$watch('binding', function(binding) {
if (!binding) { return; }
var current = binding;
var current = binding || [];
var items = [];
var itemHash = '';
for (var i = 0; i < current.length; ++i) {