← Back to team overview

dhis2-devs team mailing list archive

Previous Month Data(Opening Balance) Auto saving in the current month data entry form

 

Hi Experts,

I am getting the previous month data(Opening balance) in the data entry
screen for logistics implementation but can't save those data without
changing these cells. I have tried as bellow:

Way-1: Changing the key of one field and calling saveVal() function

$(document).on("change, keyup", "#yQfHIwxvCmb-dCWAvZ8hcrs-val", saveVal(
'ta8v9gj6aQC', 'dCWAvZ8hcrs', true));

Way-2: Changing another field that is affecting to the previous month data
field

function changeVal(){

 var varBL= $('#ta8v9gj6aQC-dCWAvZ8hcrs-val).val();
 var total=(varBL)*1;
 $('#ta8v9gj6aQC-dCWAvZ8hcrs-val).val(total);
}

$(document).on("change, keyup", "#yQfHIwxvCmb-dCWAvZ8hcrs-val",
changeVal());

Way-3: Using dhis2.de.event.dataValueSaved

dhis2.util.on( 'dhis2.de.event.dataValueSaved', function( event, ds, dv ) {
  saveVal( 'ta8v9gj6aQC', 'dCWAvZ8hcrs', true);
 // alert( 'Data value: ' + dv.value + ' was saved with data element: ' +
dv.de );
} );

Way-4: Button Based
$("#saveBtn").click(function(){
   saveVal( 'ta8v9gj6aQC', 'dCWAvZ8hcrs', true);
});

<td><button id="saveBtn" style="width:100px; font-size:10px;">Save Opening
Balance</button></td>

Please check the attachment for more details.

Can any1 help me?

Thanks
Julhas Sujan
Dhaka, Bangladesh

Attachment: Way-1 Changing one another filed and calling saveVal().JPG
Description: JPEG image

Attachment: Way2 entering data in receipt filed and auto changes in opening field.JPG
Description: JPEG image

Attachment: Way-3 Saving any dataelemnets value saveVal() function calling.JPG
Description: JPEG image