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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Set Refocus Question

Avatar

Level 2

Ok I have a form that has two text fields next to each other which has a refocus code and an "xfa.host.messageBox" error message.  I am validating each field and if if fails the user gets refocus to the field that failed.  The problem is that the refocus code jumps and enters the next text field, then exit the field and fires off an error because I have the validation in both fields checking for null or blank on exit. This causes a loop error between the two fields and the message box error to pop up one after the other because they are trying to refocus to themselves.  Is there a way to use the refocus code and not have the user jump to the next field before refocusing to the field that errored?

Thanks

Jagan

3 Replies

Avatar

Level 10

I've had a problem like this, seemed to be ok if I set pagenumber to the page that contained the field I was setting focus to first, so;

var targetObject = xfa.resolveNode(<< the som of the field >>);

xfa.host.currentPage =  xfa.layout.page(targetObject);

xfa.host.setFocus(<< the som of the field >>);

Seemed to fix my problem but I have no idea why.

Hope it helps you, Bruce

Avatar

Level 2

Thanks Bruce!  I will give it a try.

Avatar

Level 2

Hi Bruce,

I tried it but its not working for me.  Would you have a sample PDF that you can attach with the same code work that I can look at in LCD?  Any help would be appreciated.

Thanks

Jagan