mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 13:51:55 +00:00
#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:
parent
360492f15b
commit
af347cd000
@ -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
Loading…
Reference in New Issue
Block a user