Setting Text Fields

Avatar

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile
pgcarter
Level 1

14-05-2008

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?

Replies

Avatar

14-05-2008

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?

Avatar

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile
pgcarter
Level 1

15-05-2008

Yes, that is exactly what I want to do [it is an existing form] I am using 7.0

Avatar

15-05-2008

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.

Avatar

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
pgcarter
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile
pgcarter
Level 1

16-05-2008

It worked! Your instructions were perfect [I've never used script editor before]. Thank you so much.