← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4770: Added supportive mothod.

 

------------------------------------------------------------
revno: 4770
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-09-30 10:59:15 +0700
message:
  Added supportive mothod.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.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/i18n/i18n.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js	2011-09-30 03:49:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js	2011-09-30 03:59:15 +0000
@@ -1,10 +1,6 @@
 function getTranslation()
 {
-	/* Clear fields */
-	for ( var i = 0; i < propNames.length; i++ )
-	{
-		byId( propNames[i] ).value = "";
-	}
+	clearFields();
 
     var loc = getFieldValue( 'loc' );
 	
@@ -30,11 +26,7 @@
 
 function getReference()
 {
-    /* Clear fields */
-    for ( var i = 0; i < propNames.length; i++ )
-    {
-        byId( propNames[i] + " Ref" ).innerHTML = "";
-    }
+	clearFields( ' Ref' );
 
     var loc = getFieldValue( 'referenceLoc' );
 
@@ -58,6 +50,16 @@
 	}
 }
 
+function clearFields( prefix )
+{
+	prefix = prefix ? prefix : '';
+	
+    for ( var i = 0; i < propNames.length; i++ )
+    {
+        byId( propNames[i] + prefix ).innerHTML = "";
+    }
+}
+
 function addLocale()
 {
     var loc = document.getElementById("loc");