← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2840: fixed bug: 0 value doesn't delete existing data

 

------------------------------------------------------------
revno: 2840
committer: Tri <Tri@Tri-Laptop>
branch nick: dhis2
timestamp: Mon 2011-02-14 11:25:57 +0700
message:
  fixed bug: 0 value doesn't delete existing data
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-01-25 14:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-02-14 04:25:57 +0000
@@ -21,6 +21,13 @@
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
     field.style.backgroundColor = COLOR_YELLOW;
+	
+	if ( isZeroNumber( field.value ) && significantZeros.indexOf( dataElementId ) == -1 )
+	{
+		// If value is 0 and zero is not significant for data element, then skip value	
+		
+		field.value = '';
+	}
     
     if ( field.value && field.value != '' )
     {
@@ -45,14 +52,7 @@
             {
                 window.alert( i18n_value_must_negative_number + '\n\n' + dataElementName );
                 return alertField( field );
-            }
-            else if ( isZeroNumber( field.value ) && significantZeros.indexOf( dataElementId ) == -1 )
-            {
-                // If value is 0 and zero is not significant for data element, then skip value
-                
-                field.style.backgroundColor = COLOR_GREEN;
-                return;
-            }
+            }           
             else
             {
                 var minString = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].min' ).innerHTML;