hi,
I have the need to manipulate the focus event of a field. This is my pdf body structure :
form1 ----> form
|_ a ----> page
|_b ----> textfield
|_c ----> textfield
The idea is to test if the user pressed the key "ESC", "TAB" or "ENTER" when exiting from field "b". If so, and after testing the content of the field, i wanted to set the focus on that same field "b" to let the user proceed with the correction.
I tried with the "xfa.event.commitKey" to see if the "ESC", "TAB" or "ENTER" keys where pressed while exiting the field. I then redirected the focus to different fields named "ESC", "TAB" and "ENTER" just to be sure that i was getting the correct keys.
This feature works if i set the focus in a different field than the one i'm exiting.
Then, i tried a different approach. On the exit event of the field, i placed the following code :
app.setTimeOut("this.getField('form1[0].a[0].b[0]').setFocus()", 1000);
This would do the same as the setFocus after a while.
For what i could see, catching the events with the "xfa.event.commitKey" for the "ESC", "TAB" or "ENTER" key works alright. The problem is to set the focus to the current field ( the one where the exit event is being analyzed ). However, if i change the destination field to any other field on the form, all the scripts work.
Following the structure that i have on top, it the exit event is being analyzed on field "b" and the "setFocus" or the "app.setTimeOut" scripts indicate field "b" as destination, it doesn't work.
If i change the destination field to be "c", all the scripts work as expected. It seems like there is a problem with setting the focus on the field that i'm exiting from.
Any ideas on this ???
Thanks.