Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Setting Text Fields

pgcarter
Level 1
Level 1
Hello - is there a way in Designer to set the text field to automatically go to the next box? I have a form with individual boxes for letters of both first name and last name and you have to hit tab to type each letter. I want the cursor to automatically move to the next box. Can that be done in Designer?
4 Replies
Not applicable
To clarify your question. Do you want only one letter for each TextField, and then once you enter one letter per field, you want it to automatically go to the next field? This can be done. What version of Designer are you using?
pgcarter
Level 1
Level 1
Yes, that is exactly what I want to do [it is an existing form] I am using 7.0
Not applicable
This is what I did in Version 7.1.2, but it should work in 7.0.



I created four TextFields: TextField1, TextField2, TextField3, TextField4. If it is a TextField, under the Field tab, I also limited the max. characters to 1. If it is a numeric field, you don't have that option, but using the script below will limit the maxLength to 1 character.



On the Change event, using JavaScript, I added the following script:



var maxLength = 1;

var currentLength = xfa.event.newText.length;



// Change focus to next field if maxium length reached.

if( currentLength == maxLength )

{

xfa.host.setFocus("TextField2");

}



What this script should do, is once it reaches the maxLength (being 1), it sets the focus to the next field. Add this script to the second field, changing the object name to "TextField3", etc.
pgcarter
Level 1
Level 1
It worked! Your instructions were perfect [I've never used script editor before]. Thank you so much.