dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12426
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3827: Data entry - Fixed bug when pressing Enter in each active field. It's skipping the disabled and/o...
------------------------------------------------------------
revno: 3827
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-02 09:57:58 +0700
message:
Data entry - Fixed bug when pressing Enter in each active field. It's skipping the disabled and/or hidden one.
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-05-10 08:58:10 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-06-02 02:57:58 +0000
@@ -302,7 +302,7 @@
{
var key = event.keyCode || event.charCode || event.which;
- var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( key == 38 ) ? getPreviousEntryField( field ) : false;
+ var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( ( key == 38 ) ? getPreviousEntryField( field ) : false );
if ( focusField )
{
@@ -314,16 +314,20 @@
function getNextEntryField( field )
{
- var fields = $('input[name="entryfield"]');
-
- var index = field.tabIndex;
-
- 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;
+ }
+ }
}
function getPreviousEntryField( field )