← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17888: fix in validation - no need to enforce type if value is null and not compulsory

 

------------------------------------------------------------
revno: 17888
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-05 18:28:31 +0100
message:
  fix in validation - no need to enforce type if value is null and not compulsory
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js	2014-12-18 11:50:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js	2015-01-05 17:28:31 +0000
@@ -119,10 +119,12 @@
             var numberType = attrs.numberType;
             
             ctrl.$parsers.unshift(function(value) {
-                var isValid = checkValidity(numberType, value);
-                ctrl.$setValidity(fieldName, isValid);
-                return isValid ? value : undefined;
-            });            
+            	if(value){
+                    var isValid = checkValidity(numberType, value);
+                	ctrl.$setValidity(fieldName, isValid);
+                	return isValid ? value : undefined;
+                }
+            });
            
             ctrl.$formatters.unshift(function(value) {
                 if(value){