← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3837: Applied patch from Hieu. Fixes bug with order in navigation with arrows/enter in data entry. Also...

 

------------------------------------------------------------
revno: 3837
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-06-03 16:19:24 +0200
message:
  Applied patch from Hieu. Fixes bug with order in navigation with arrows/enter in data entry. Also makes navigation more robust in terms of potential hidden input fields. Good work.
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 08:44:31 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-06-03 14:19:24 +0000
@@ -314,30 +314,36 @@
 
 function getNextEntryField( field )
 {
-    var fields = $('input[name="entryfield"]');
-
-    var index = field.tabIndex;
-    
-    while (fields[index]) {
-        if (!fields[index].disabled) {
-            return fields[index];
-        }
-        index++;
-    }
+	var index = field.getAttribute( 'tabindex' );
+	
+	field = $( 'input[name="entryfield"][tabindex="' + (++index) + '"]' );
+	
+	while ( field )
+	{
+		if ( field.is( ':disabled' ) || field.is( ':hidden' ) ) {
+			field = $( 'input[name="entryfield"][tabindex="' + (++index) + '"]' );
+		}
+		else {
+			return field;
+		}
+	}
 }
 
 function getPreviousEntryField( field )
 {
-    var fields = $('input[name="entryfield"]');
-    
-    var index = field.tabIndex - 2;
-    
-    while (fields[index]) {
-        if (!fields[index].disabled) {
-            return fields[index];
-        }
-        index--;
-    }
+	var index = field.getAttribute( 'tabindex' );
+	
+	field = $( 'input[name="entryfield"][tabindex="' + (--index) + '"]' );
+	
+	while ( field )
+	{
+		if ( field.is( ':disabled' ) || field.is( ':hidden' ) )	{
+			field = $( 'input[name="entryfield"][tabindex="' + (--index) + '"]' );
+		}
+		else {
+			return field;
+		}
+	}
 }
 
 // -----------------------------------------------------------------------------