← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18874: Fixed bug - Exception thrown when to update Data Element Group Member in Data Element Group Edito...

 

------------------------------------------------------------
revno: 18874
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-10 15:03:52 +0700
message:
  Fixed bug - Exception thrown when to update Data Element Group Member in Data Element Group Editor form, View 1
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.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-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js	2015-03-10 11:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js	2015-04-10 08:03:52 +0000
@@ -145,6 +145,8 @@
         text : i18n_save,
         click : function()
         {
+			jQuery( '#addDataElementGroupForm #shortName' ).closest('tr').show();
+			jQuery( '#addDataElementGroupForm #code' ).closest('tr').show();
 			if( jQuery( '#addDataElementGroupForm #name' ).val() == "" ){
 				markValid( "addDataElementGroupForm #shortName" );
 				markInvalid( "addDataElementGroupForm #name", i18n_this_field_is_required );
@@ -156,18 +158,9 @@
 			else
 			{
 				jQuery.postJSON( "validateDataElementGroup.action", {
-					name : function()
-					{
-						return jQuery( '#addDataElementGroupForm #name' ).val();
-					}
-					,shortName : function()
-					{
-						return jQuery( '#addDataElementGroupForm #shortName' ).val();
-					}
-					,code : function()
-					{
-						return jQuery( '#addDataElementGroupForm #code' ).val();
-					}
+					name : jQuery( '#addDataElementGroupForm #name' ).val()
+					,shortName : jQuery( '#addDataElementGroupForm #shortName' ).val()
+					,code : jQuery( '#addDataElementGroupForm #code' ).val()
 				}, function( json )
 				{
 					if ( json.response == 'success' )
@@ -181,10 +174,14 @@
 							code : jQuery( '#addDataElementGroupForm #code' ).val()
 						}, function( json )
 						{
-							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+							var id = json.dataElementGroup.id;
+							dataElementGroups[id] = json.dataElementGroup.name;
+							dataElementGroupShortNames[id] = json.dataElementGroup.name;
+							dataElementGroupCodes[id] = json.dataElementGroup.shortName;
 							loadAvailableGroups();
+							jQuery( "#view_1 #selectedDataElements" ).empty();
+							$("#dataElementGroups option:contains('" + jQuery( '#addDataElementGroupForm #name' ).val() + "')").attr("selected",true);
 							loadAvailableDataElements();
-							jQuery( "#view_1 #selectedDataElements" ).empty();
 							jQuery( '#addDataElementGroupForm' ).dialog( 'close' );
 						} );
 					} else
@@ -402,11 +399,12 @@
 function updateGroupMembers()
 {
     var id = jQuery( "#view_1 #dataElementGroups" ).val();
+	var name = dataElementGroups[id];
 	var shortName = dataElementGroupShortNames[id];
 	var code = dataElementGroupCodes[id];
 
-    jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&"
-			+ "shortName=" + shortName + "&code=" + code + "&"
+    jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id
+			+ "&name=" + name + "&shortName=" + shortName + "&code=" + code + "&"
             + toQueryString( '#view_1 #selectedDataElements', 'deSelected' ), function( json )
     {
     	setHeaderDelayMessage( i18n_update_success );