Expand my Community achievements bar.

Automatic tabbing between fields?

Avatar

Level 1

Persons using my form don't want to have to hit TAB to move to the next field (and the next field and the next field). Is there a way to make their cursor move to the next field automatically after they type the maximum number of characters in the previous field? I have the tabbing order set the way I want it. I just want these tabs to occur automatically for the user after each field it filled. Thanks!

3 Replies

Avatar

Level 10

Try placing the below code in the full event of the previous field.. (Java Script)

xfa.host.setFocus("TextField3");

where TextField3 is the next field in the order..This way once the TextField2 is full then the cursor will be moved to TextField3.. You may need to do the same in TextField3 to move the cursor to TextField4 and so on..

Thanks

Srini

Avatar

Level 6

Function: for example "CommonScripts" created under variables

/*

* @param - oCurrField - Current field object

* @param - sCurrFieldVal - Current field value

*/

function autoTab(oCurrField, sCurrFieldVal)

{

try

{

  var currFieldMaxChars = oCurrField.value.text.maxChars;

  //app.alert("Current Field Max: " + currFieldMaxChars);

  if ( currFieldMaxChars != 0 )

  {

   if ( sCurrFieldVal.length == currFieldMaxChars )

   {

    var sNextField = oCurrField.traversal.resolveNode("#traverse").ref;

    //app.alert("Next Tab Field: " + sNextField);

    if ( sNextField != null )

    {

     xfa.host.setFocus( sNextField );

    }

   }

  }

}

catch(e){}

}

Call the above function on Change event of the fields where u want the auto tab (when reached the max. char. length)

var currFieldVal = xfa.event.newText;

CommonScripts.autoTab(this, currFieldVal);

Sample file: u can go to this post if need a sample. the code placed for only first row fist part in the table.

http://forums.adobe.com/message/2365506#2365506

Hope this will help with ur requirement.

RAGHU.