Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Set Refocus Question

Avatar

Former Community Member

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

Former Community Member

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