← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6850: Fixed getFieldValue method in commons.js

 

------------------------------------------------------------
revno: 6850
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-05-04 10:27:35 +0700
message:
  Fixed getFieldValue method in commons.js
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2012-04-26 18:32:46 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2012-05-04 03:27:35 +0000
@@ -439,9 +439,11 @@
 {
 	if ( getTypeById( fieldId, 'multiple' ) )
 	{
-		return jQuery("#" + fieldId).val()[0];
+		var selectedItem = jQuery("#" + fieldId).children( "option:selected" )[0];
+		
+		return (selectedItem ? selectedItem.value : selectedItem);
 	}
-	
+
 	return jQuery("#" + fieldId).val();
 }