← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21681: Minor

 

------------------------------------------------------------
revno: 21681
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2016-01-10 23:32:15 +0100
message:
  Minor
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm


--
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-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js	2015-10-20 09:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js	2016-01-10 22:32:15 +0000
@@ -66,27 +66,29 @@
 }
 
 function getTrackedEntityDataElements( type ) {
-  var fieldId = type + '-data-elements';
-  clearListById(fieldId);
-  
-  var psSelectId = type + '-program-stage';
-  var programStageId = getFieldValue(psSelectId);
-
-  jQuery.getJSON('getTrackedEntityDataElements.action',
-    {
-      programId: getFieldValue('programId'),
-      programStageUid: programStageId
-    }, function( json ) {
-      var dataElements = jQuery('#' + fieldId);
-      for( i in json.dataElements ) {
-		var de = json.dataElements[i];
-		
-		if ( !('expression' == type && de.valueType && dhis2.pi.aggregatableValueTypes.indexOf(de.valueType) == -1)) {
-          dataElements.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + 
-            "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
-        }
-      }
-    });
+    var fieldId = type + '-data-elements';
+    clearListById(fieldId);
+
+    var psSelectId = type + '-program-stage';
+    var programStageId = getFieldValue(psSelectId);
+
+    if(programStageId) {
+      jQuery.getJSON('getTrackedEntityDataElements.action',
+        {
+          programId: getFieldValue('programId'),
+          programStageUid: programStageId
+        }, function( json ) {
+          var dataElements = jQuery('#' + fieldId);
+          for( i in json.dataElements ) {
+                    var de = json.dataElements[i];
+
+                    if ( !('expression' == type && de.valueType && dhis2.pi.aggregatableValueTypes.indexOf(de.valueType) == -1)) {
+              dataElements.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + 
+                "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
+            }
+          }
+        });
+    }
 }
 
 function insertDataElement( type ) {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2015-10-20 09:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2016-01-10 22:32:15 +0000
@@ -25,7 +25,7 @@
 		        <tr>
 					<td>
 						<select id="expression-program-stage" onChange="getTrackedEntityDataElements('expression');" style="width:35%;margin-right:20px;">
-							<option>[ $i18n.getString('select_program_stage') ]</option>
+							<option value='' >[ $i18n.getString('select_program_stage') ]</option>
 							#foreach( $programStage in $program.programStages )
 								<option value='$programStage.uid'>$programStage.displayName</option>
 							#end