← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4721: Jquerified category javascript

 

------------------------------------------------------------
revno: 4721
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 15:25:44 +0200
message:
  Jquerified category javascript
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/category.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/category.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/category.js	2011-09-27 12:16:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/category.js	2011-09-27 13:25:44 +0000
@@ -70,23 +70,18 @@
 
 function getSelectedCategoryOption()
 {
-	var categoryOptions = byId('categoryOptions');
-	byId('categoryOptionName').value=categoryOptions[categoryOptions.selectedIndex].text;
+	var selected = $( '#categoryOptions :selected' ).text();
+	$( '#categoryOptionName' ).val( selected );
 }
 
 function updateCategoryOptionName()
 {
-	var request = new Request();
-    request.setResponseTypeXML( 'xmlObject' );
-    request.setCallbackSuccess( updateCategoryOptionNameReceived );
-	var params = "id=" + byId('categoryOptions').value;
-		params += '&name=' + byId('categoryOptionName').value;
-	request.sendAsPost(params);
-	request.send('updateDataElementCategoryOption.action');
-}
-
-function updateCategoryOptionNameReceived(xmlObject){
-	var categoryOptions = byId('categoryOptions');
-	categoryOptions[categoryOptions.selectedIndex].text = byId('categoryOptionName').value;
-	showSuccessMessage( i18n_option_rename_successfully );
+	var id = $( '#categoryOptions :selected' ).val();
+	var name = $( '#categoryOptionName' ).val();
+	
+	var url = 'updateDataElementCategoryOption.action?id=' + id + '&name=' + name;
+	
+	$.postUTF8( url, {}, function() {
+		$( '#categoryOptions :selected' ).text( name );
+	} );
 }