Expand my Community achievements bar.

SOLVED

Automatic tab when reaching the end of a field with limited character number

Avatar

Former Community Member

Hello!

Is there a way of activating an automatic tab behaviour when the user reaches the end of a field with limited character number?

I'd like the cursor to jump to the next field in tab order automatically.

Possible?

Thank you for any hints!

Marcos

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi,

What if you tried something like the following example? This works using formCalc on the change event for the field the user is currently typing into:

    var fullCount = 3
    var currentString = xfa.event.newText
    if(Len(currentString) >= fullCount)then
        xfa.host.setFocus("TextField2")
    endif

Or, if you prefer javaScript:

    var fullCount = 3;
    var currentString = xfa.event.newText;
    if(currentString.length >= fullCount){
        xfa.host.setFocus("TextField2");
    }

These work very smoothly.

Hope this helps!

Stephen

View solution in original post

4 Replies

Avatar

Correct answer by
Level 7

Hi,

What if you tried something like the following example? This works using formCalc on the change event for the field the user is currently typing into:

    var fullCount = 3
    var currentString = xfa.event.newText
    if(Len(currentString) >= fullCount)then
        xfa.host.setFocus("TextField2")
    endif

Or, if you prefer javaScript:

    var fullCount = 3;
    var currentString = xfa.event.newText;
    if(currentString.length >= fullCount){
        xfa.host.setFocus("TextField2");
    }

These work very smoothly.

Hope this helps!

Stephen

Avatar

Former Community Member

Hey Kingphysh!

This one worked fine with text, number and data fields (so far I've tested with these) and solves my problem!

Thank you!

Marcos

Avatar

Former Community Member

Hey Radzmar!

Works nice with text fields!

Thanks!