← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17177: bugfix for data-entry, when switching periods... make sure that old calendar is destroyed properl...

 

------------------------------------------------------------
revno: 17177
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-10-20 18:13:52 +0700
message:
  bugfix for data-entry, when switching periods... make sure that old calendar is destroyed properly, and everything is cleaned up
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-10-17 08:04:54 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2014-10-20 11:13:52 +0000
@@ -417,6 +417,18 @@
     {
         var id = $( this ).attr( 'id' );
 
+        // if entryfield is a datepicker, remove old target field, and change id
+        if( /-dp$/.test(id) ) {
+          var dpTargetId = id.substring(0, id.length - 3);
+          $('#' + dpTargetId).remove();
+
+          $( this )
+            .attr('id', dpTargetId)
+            .calendarsPicker('destroy');
+
+          id = dpTargetId;
+        }
+
         var split = splitFieldId( id );
         var dataElementId = split.dataElementId;
         var optionComboId = split.optionComboId;