← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3068: Improved code.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3068 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-18 11:05:54 +0100
message:
  Improved code.
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-03-18 09:39:37 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-03-18 10:04:25 +0000
@@ -329,20 +329,14 @@
 function getNextEntryField( field )
 {
     var fields = $('input[name="entryfield"]');
+
+    var index = field.tabIndex;
     
-    if (fields[field.tabIndex]) {
-        if (!fields[field.tabIndex].disabled) {
-            return fields[field.tabIndex];
-        }
-        else {
-            var index = field.tabIndex + 1;
-            while (fields[index]) {
-                if (!fields[index].disabled) {
-                    return fields[index];
-                }
-                index++;
-            }
-        }
+    while (fields[index]) {
+        if (!fields[index].disabled) {
+            return fields[index];
+        }
+        index++;
     }
 }
 
@@ -350,19 +344,13 @@
 {
     var fields = $('input[name="entryfield"]');
     
-    if (fields[field.tabIndex - 2]) {
-        if (!fields[field.tabIndex - 2].disabled) {
-            return fields[field.tabIndex - 2];
-        }
-        else {
-            var index = field.tabIndex - 3;
-            while (fields[index]) {
-                if (!fields[index].disabled) {
-                    return fields[index];
-                }
-                index--;
-            }
-        }
+    var index = field.tabIndex - 2;
+    
+    while (fields[index]) {
+        if (!fields[index].disabled) {
+            return fields[index];
+        }
+        index--;
     }
 }