diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js
index 20931a4e26..8fd91ef9d6 100644
--- a/awx/ui/static/js/helpers/JobSubmission.js
+++ b/awx/ui/static/js/helpers/JobSubmission.js
@@ -517,9 +517,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
if(question.type === 'integer'){
min = (!Empty(question.min)) ? Number(question.min) : "";
max = (!Empty(question.max)) ? Number(question.max) : "" ;
- html+=''+
+ html+=''+
'
A value is required!
'+
- 'This is not valid integer!
'+
+ 'This is not valid integer!
'+
' The value must be in range {{'+min+'}} to {{'+max+'}}!
';
}
@@ -528,7 +528,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
min = (!Empty(question.min)) ? question.min : "";
max = (!Empty(question.max)) ? question.max : "" ;
defaultValue = (!Empty(question.default)) ? question.default : (!Empty(question.default_float)) ? question.default_float : "" ;
- html+=''+
+ html+=''+
'This is not valid float!
'+
' The value must be in range {{'+min+'}} to {{'+max+'}}!
';
}
diff --git a/awx/ui/static/lib/ansible/directives.js b/awx/ui/static/lib/ansible/directives.js
index a67e4ce039..362fbbb4a2 100644
--- a/awx/ui/static/lib/ansible/directives.js
+++ b/awx/ui/static/lib/ansible/directives.js
@@ -148,23 +148,17 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
return {
restrict: 'A',
require: 'ngModel',
- // scope: true,
link: function (scope, elem, attr, ctrl) {
- scope.$watch(attr.ngMin, function () {
- ctrl.$setViewValue(ctrl.$viewValue);
- });
- var minValidator = function (value) {
+ ctrl.$parsers.unshift( function(viewValue) {
var min = (attr.ngMin) ? scope.$eval(attr.ngMin) : -Infinity;
- if (!Empty(value) && Number(value) < min) {
+ if (!Empty(viewValue) && Number(viewValue) < min) {
ctrl.$setValidity('ngMin', false);
return undefined;
} else {
ctrl.$setValidity('ngMin', true);
- return value;
+ return viewValue;
}
- };
- ctrl.$parsers.push(minValidator);
- ctrl.$formatters.push(minValidator);
+ });
}
};
}])
@@ -173,28 +167,21 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
return {
restrict: 'A',
require: 'ngModel',
- // scope: true,
link: function (scope, elem, attr, ctrl) {
- scope.$watch(attr.ngMax, function () {
- ctrl.$setViewValue(ctrl.$viewValue);
- });
- var maxValidator = function (value) {
- var max = scope.$eval(attr.ngMax) || Infinity;
- if (!Empty(value) && Number(value) > max) {
+ ctrl.$parsers.unshift( function(viewValue) {
+ var max = (attr.ngMax) ? scope.$eval(attr.ngMax) : Infinity;
+ if (!Empty(viewValue) && Number(viewValue) > max) {
ctrl.$setValidity('ngMax', false);
return undefined;
} else {
ctrl.$setValidity('ngMax', true);
- return value;
+ return viewValue;
}
- };
- ctrl.$parsers.push(maxValidator);
- ctrl.$formatters.push(maxValidator);
+ });
}
};
}])
-
.directive('smartFloat', function() {
var FLOAT_REGEXP_1 = /^\$?\d+(.\d{3})*(\,\d*)?$/, //Numbers like: 1.123,56
FLOAT_REGEXP_2 = /^\$?\d+(,\d{3})*(\.\d*)?$/; //Numbers like: 1,123.56