← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3828: Data entry - Fixed bug when pressing the UP button in each field to back the previous field.

 

------------------------------------------------------------
revno: 3828
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-02 10:07:52 +0700
message:
  Data entry - Fixed bug when pressing the UP button in each field to back the previous field.
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-06-02 02:57:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-06-02 03:07:52 +0000
@@ -332,18 +332,21 @@
 
 function getPreviousEntryField( field )
 {
-    var fields = $('input[name="entryfield"]');
-    
-    var index = field.tabIndex - 2;
-    
-    while (fields[index]) {
-        if (!fields[index].disabled) {
-            return fields[index];
-        }
-        index--;
-    }
+	if ( field )
+	{
+		var index = field.getAttribute( 'tabindex' );
+		field = $('input[tabindex="'+(--index)+'"]');
+		
+		while ( field )
+		{
+			if ( field.is(':disabled') || field.is(':hidden') )
+			{
+				field = $('input[tabindex="'+(--index)+'"]');
+			}
+			else return field;
+		}
+	}
 }
-
 // -----------------------------------------------------------------------------
 // Data completeness
 // -----------------------------------------------------------------------------