Here's a topic from yesterday that discusses something very similar (a or d instead of 1 or 3): http://forums.adobe.com/thread/940007
You should be able to adapt this to suit your needs, but if you get stuck, post again.
Thanks - I read that, but was confused about the keystroke event function.
if all I want is to require the field to contain either a 1 or a 3, would it be just this:
// Get everything that's entered in the field
var val = AFMergeChange(event);
// Reject everything other than 1 or 3,
event.rc = AFExactMatch(/^(1|3)$/i, val);
What more do I need to make it a script?
Do I need to start with the
and end with
1 person found this helpful
You would normally be able to place the keystroke script code directly into the editor, but since the code I showed uses some built-in functions, you have to do it the way I described due to what I consider to be a bug in Acrobat.
Also, you're showing the validate tab. It would be possible to validate the entry after the user commits it, and reject any invalid entries, but the keystroke script approach will prevent the user from being able to make invalid entries in the first place. Whether this is the best approach is for you to say. If you want to go with a validate script, the code would necessarily be different than the code for a keystroke script. Post again if this is what you want and I can revise the code to work as a validate script.