=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2011-09-30 11:13:16 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2011-10-04 11:18:18 +0000 @@ -272,16 +272,23 @@ value = value.trim(); + if ( value == null || value.length() == 0 || !SectionFormUtils.isInteger( value ) ) + { + if ( dataValue != null ) + { + dataValueService.deleteDataValue( dataValue ); + } + + continue; + } + if ( dataValue == null ) { - if ( value != null && value.length() > 0 ) - { - needsValidation = true; + needsValidation = true; - dataValue = new DataValue( dataElement, period, organisationUnit, value, storedBy, new Date(), - null, optionCombo ); - dataValueService.addDataValue( dataValue ); - } + dataValue = new DataValue( dataElement, period, organisationUnit, value, storedBy, new Date(), + null, optionCombo ); + dataValueService.addDataValue( dataValue ); } else { === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java 2011-09-30 11:13:16 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java 2011-10-04 11:18:18 +0000 @@ -209,6 +209,20 @@ // Static Utils // ------------------------------------------------------------------------- + public static boolean isInteger( String value ) + { + try + { + Integer.parseInt( value ); + } + catch ( NumberFormatException e ) + { + return false; + } + + return true; + } + public static boolean valueHigher( String value, int max ) { int integerValue;