← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13402: Data entry, fixed minor bug, when data set is unselected while form is loaded then form must be c...

 

------------------------------------------------------------
revno: 13402
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 14:54:40 +0100
message:
  Data entry, fixed minor bug, when data set is unselected while form is loaded then form must be cleared
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	2013-12-22 15:33:20 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-12-23 13:54:40 +0000
@@ -938,23 +938,23 @@
     var dataSetId = $( '#selectedDataSetId' ).val();
     var periodId = $( '#selectedPeriodId' ).val();
     
-    dhis2.de.currentCategories = dhis2.de.getCategories( dataSetId );
-    
-    var periodType = dhis2.de.dataSets[dataSetId].periodType;
-    var allowFuturePeriods = dhis2.de.dataSets[dataSetId].allowFuturePeriods;
-    var periods = dhis2.de.periodTypeFactory.get( periodType ).generatePeriods( dhis2.de.currentPeriodOffset );
-    periods = dhis2.de.periodTypeFactory.reverse( periods );
-    
-    if ( allowFuturePeriods == false )
-    {
-    	periods = dhis2.de.periodTypeFactory.filterFuturePeriods( periods );
-    }
-
     if ( dataSetId && dataSetId != -1 )
     {
+	    var periodType = dhis2.de.dataSets[dataSetId].periodType;
+	    var allowFuturePeriods = dhis2.de.dataSets[dataSetId].allowFuturePeriods;
+	    var periods = dhis2.de.periodTypeFactory.get( periodType ).generatePeriods( dhis2.de.currentPeriodOffset );
+	    periods = dhis2.de.periodTypeFactory.reverse( periods );
+	    
+	    if ( allowFuturePeriods == false )
+	    {
+	    	periods = dhis2.de.periodTypeFactory.filterFuturePeriods( periods );
+	    }
+
         clearListById( 'selectedPeriodId' );
         clearSectionFilters();
-        
+
+        dhis2.de.currentCategories = dhis2.de.getCategories( dataSetId );
+
         var attributeMarkup = dhis2.de.getAttributesMarkup();
         $( '#attributeComboDiv' ).html( attributeMarkup );
 
@@ -988,6 +988,10 @@
             clearEntryForm();
         }
     }
+    else
+    {
+        clearEntryForm();
+    }
 }
 
 // -----------------------------------------------------------------------------