My question is similar to another one of my posts, but it's a little more specific.
Assume I'm typing in a text box, and the fieldFull event is triggered. I would like to change the text in that text box.
The Acrobat scripting guide gives the following example for fieldFull:
This example doesn't work consistently and has the annoying habit of occasionally resetting the field without changing the data.
In addition, I don't want all the data in the box - I'd like to cut it off. It's easy enough for me to store in a variable all the data I'd like to put in the text box; the problem is actually changing the text box value programmatically. I've tried setting focus to another field and then changing the value, resetting the form and then changing the value, etc., but I always get an InvalidSetError: Set not possible, invalid or unkown.
So apparently, focus isn't relinquished until all scripts have completed. Therefore, I write a script that changes the value of the field and attach the script to the onFocus event of another field. I then set the focus to that other field and it works.