dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25382
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12582: minor changes
------------------------------------------------------------
revno: 12582
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-10-11 11:28:07 +0200
message:
minor changes
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/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-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 2013-09-19 12:43:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 2013-10-11 09:28:07 +0000
@@ -75,7 +75,7 @@
<tr>
<td>
<input id='$id' name="$id" options='no' type='radio' optionset='$programStageDataElement.dataElement.optionSet.uid'
- data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
+ data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
#if( $patientDataValue.value == $option) checked #end
onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$i18n.getString("non_value")
</td>
@@ -88,7 +88,7 @@
<td>
<input id='$id' name="$id" type='radio' options='no' optionset='$programStageDataElement.dataElement.optionSet.uid'
data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
- #if( $patientDataValue.value == $option) checked #end
+ #if( $patientDataValue.value == $option) checked #end value="$encoder.htmlEncode($option)"
onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$encoder.htmlEncode($option)
</td>
#set($index=$index + 1)
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-10-11 08:00:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-10-11 09:28:07 +0000
@@ -743,6 +743,25 @@
}
};
+function checkAndSetCheckbox( $field, value ) {
+ if( $field.attr('type') === 'checkbox' ) {
+ if( value === "true" || value === true ) {
+ $field.attr('checked', true);
+ } else {
+ $field.removeAttr('checked');
+ }
+ }
+}
+
+function checkAndSetRadio( $field, value ) {
+ if( $field.attr('type') === 'radio' ) {
+ if( $.trim(value) === $.trim($field.val()) ) {
+ $field.attr('checked', true);
+ $field[0].checked = true;
+ }
+ }
+}
+
function loadProgramStageInstance( programStageInstanceId, always ) {
$( "#programStageInstanceId" ).val( programStageInstanceId );
$( "#entryFormContainer input[id='programStageInstanceId']" ).val( programStageInstanceId );
@@ -756,11 +775,9 @@
var field = $('#' + fieldId);
if ( field ) {
+ checkAndSetCheckbox(field, obj.values[key].value);
+ checkAndSetRadio(field, obj.values[key].value);
field.val( decodeURI( obj.values[key].value ) );
-
- if( obj.values[key].value === "true" && field.attr('type') === 'checkbox' ) {
- field.attr('checked', true);
- }
}
});
}
@@ -855,11 +872,9 @@
var field = $('#' + fieldId);
if ( field ) {
+ checkAndSetCheckbox(field, value.value);
+ checkAndSetRadio(field, value.value);
field.val( decodeURI( value.value ));
-
- if( value.value === "true" && field.attr('type') === 'checkbox' ) {
- field.attr('checked', true);
- }
}
} );