#2794-numeric Validation in Create Fixed Deposit Product View

Added Numeric Validation to the textfields in Create Fixed Deposit Product View .Added decimal number attribute to late-validate directive to validate decimal numbers.
This commit is contained in:
Jov03 2018-12-28 13:52:43 +05:30 committed by ShruthiRajaram
parent 360492f15b
commit af347cd000
2 changed files with 284 additions and 314 deletions

View File

@ -2,11 +2,13 @@
mifosX.directives = _.extend(module, {
LateValidateDirective: function () {
var numRegex = /^([0-9])*([0-9]+(,)[0-9]+)*$/;
var decimalRegex=/^([0-9])*([0-9]+(,)[0-9]+)*([0-9]+(\.)[0-9]+)*$/;
return {
restrict: 'A',
require: 'ngModel',
scope:{
number:'@number'
number:'@number',
decimalNumber:'@decimalNumber'
},
link: function (scope, elm, attr, ctrl) {
@ -14,6 +16,7 @@
elm.bind('blur', function () {
scope.$apply(function () {
var isMatchRegex = numRegex.test(elm.val());
var isDecimalMatchRegex=decimalRegex.test(elm.val());
if (elm.val() == "") {
ctrl.$setValidity('req', false);
} else {
@ -26,6 +29,13 @@
ctrl.$setValidity('nval', false);
}
}
if(scope.decimalNumber) {
if (isDecimalMatchRegex || elm.val() == '') {
ctrl.$setValidity('nval', true);
} else {
ctrl.$setValidity('nval', false);
}
}
});
});
}

File diff suppressed because it is too large Load Diff