dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12628
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3929: Fixed bug in logic code for data entry when inputting data for each field type. And removed unnec...
------------------------------------------------------------
revno: 3929
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-06-17 16:07:15 +0700
message:
Fixed bug in logic code for data entry when inputting data for each field type. And removed unneccessary method.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-06-16 09:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-06-17 09:07:15 +0000
@@ -1447,14 +1447,6 @@
}
/**
- * For example: Zero without decimal sign.
- */
-function isPureZero( value )
-{
- return (value.indexOf(".") == -1);
-}
-
-/**
* Allow only integers or a single Zero. No thousands seperators
*/
function isInt(value)
=== 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-06-16 09:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2011-06-17 09:07:15 +0000
@@ -97,7 +97,7 @@
function saveValueInternal( dataElementId, optionComboId, dataElementName )
{
var field = document.getElementById( 'value[' + dataElementId + '].value' + ':' + 'value[' + optionComboId + '].value');
- var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML;
+ var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML;
var organisationUnitId = getFieldValue( 'organisationUnitId' );
field.style.backgroundColor = COLOR_YELLOW;
@@ -111,28 +111,31 @@
// If value is 0 and zero is not significant for data element, then skip value
if ( significantZeros.indexOf( dataElementId ) == -1 )
{
- window.alert( i18n_field_unallowed_save_zero + '\n\n' + dataElementName );
- return alertField( field );
+ field.style.backgroundColor = COLOR_GREEN;
+ field.value = '';
+ field.select();
+ field.focus();
+ return false;
}
- field.value = isPureZero( field.value ) ? "0" : "0.0";
+ field.value = (field.value.indexOf(".") == -1) ? "0" : "0.0";
}
- else if ( type == 'int' && !isInt( field.value ) && ( field.value.length >= 255 ) )
+ else if ( type == 'int' && ( !isInt( field.value ) || ( field.value.length >= 255 ) ) )
{
window.alert( i18n_value_must_integer + '\n\n' + dataElementName );
return alertField( field );
}
- else if ( type == 'number' && !isRealNumber( field.value ) && ( field.value.length >= 255 ) )
+ else if ( type == 'number' && ( !isRealNumber( field.value ) || ( field.value.length >= 255 ) ) )
{
window.alert( i18n_value_must_number + '\n\n' + dataElementName );
return alertField( field );
}
- else if ( type == 'positiveNumber' && !isPositiveInt( field.value ) && ( field.value.length >= 255 ) )
+ else if ( type == 'positiveNumber' && ( !isPositiveInt( field.value ) || ( field.value.length >= 255 ) ) )
{
window.alert( i18n_value_must_positive_integer + '\n\n' + dataElementName );
return alertField( field );
}
- else if ( type == 'negativeNumber' && !isNegativeInt( field.value ) && ( field.value.length >= 255 ) )
+ else if ( type == 'negativeNumber' && ( !isNegativeInt( field.value ) || ( field.value.length >= 255 ) ) )
{
window.alert( i18n_value_must_negative_integer + '\n\n' + dataElementName );
return alertField( field );
Follow ups