← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6101: Use jQuery methods insteads of Request object in dhis-web-maintenance-datadictionary.

 

------------------------------------------------------------
revno: 6101
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-24 15:21:11 +0700
message:
  Use jQuery methods insteads of Request object in dhis-web-maintenance-datadictionary.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.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/dataElementGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.js	2011-09-27 07:36:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.js	2012-02-24 08:21:11 +0000
@@ -16,25 +16,21 @@
 
 function validateAddDataElementGroupSet()
 {
-    var request = new Request();
-    request.setResponseTypeXML( 'message' );
-    request.setCallbackSuccess( validateAddDataElementGroupSetCompleted );
-    request.sendAsPost( "name=" + getFieldValue( "name" ) );
-    request.send( "validateDataElementGroupSet.action" );
-}
-
-function validateAddDataElementGroupSetCompleted( message )
-{
-    var type = message.getAttribute( "type" );
-
-    if ( type == "success" )
-    {
-        selectAllById( "groupMembers" );
-        document.forms['addDataElementGroupSet'].submit();
-    } else
-    {
-        setMessage( message.firstChild.nodeValue );
-    }
+   $.post( 'validateDataElementGroupSet.action',{name:getFieldValue( "name" )}
+		, function( messageElement ) 
+		{
+			messageElement = messageElement.getElementsByTagName( 'message' )[0];
+			var type = messageElement.getAttribute( "type" );
+			if ( type == "success" )
+			{
+				selectAllById( "groupMembers" );
+				document.forms['addDataElementGroupSet'].submit();
+			} 
+			else
+			{
+				setMessage( messageElement.firstChild.nodeValue );
+			}
+		} );
 }
 
 // -----------------------------------------------------------------------------