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?
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
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.