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
BedrockMission!

Learn More

View all

Sign in to view all badges

How do I set focus after initialization?

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

13-03-2013

Problem: I'm having trouble setting the focus to a new text field after it is initialized.

Background: I have created a form with a table that creates a new row after leaving the last textfield/cell in the last row if it is needed. Once I tab out of the last field, focus is lost completely--i.e., tabbing does not reach any other parts of the form.

Attempts: I have attempted to set focus on the first text field in the new row by using (rowNum is a variable for the newly created row)

xfa.host.setFocus("xfa[0].form[0].form1[0].#subform[0].Subform2[0].Table1[0].Row1[rowNum].TextField1[0]");

and

this.parent.parent.Row1[rowNum].TextField1.setFocus();

I have also tried to set focus back to the last field I had just exited with

xfa.host.setFocus("this");

I have also tried using the action builder to bring focus to the newly created textfield when it is initialized.

[edit] I forgot to say that the attempt to set the focus back to the last field I had just exited actually worked. [/edit]

Message was edited by: jasotastic81

View Entire Topic

Avatar

Avatar
Validate 1
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
past-tense
Level 2

13-03-2013

Looks like you used the variable as a literal string... you need to concatenate the value of the variable into the SOM expression:

xfa.host.setFocus("xfa[0].form[0].form1[0].#subform[0].Subform2[0].Tab le1[0].Row1[" + rowNum + "].TextField1[0]");

Note the two + around the variable name, to join it's value with the rest of the string.

Let us know if this helps.

-Scott