Copy link to clipboard
Copied
Good afternoon Community,
Hope all is enjoying your weekend. I have a question on formatting a field in Adobe Acrobat. I would like to have the following result when someone keys in the information in a particular field. I've been trying to come up with a Custom Keystroke Script in the formatting section of Adobe. The Arbitrary Mask is not working. I would like to limit what someone can key into the field to: All alphabet letters (small cap and cap), numbers 0-9 and i would like to allow them to put in a hyphen "-". No spaces. No characters etc. I've come up with the first part below and this works for all small cap alphabet letters. I have no idea to include the rest. Anyone have any ideas? Thank you in advance for any input.
event.rc=/^[a-z]*$/.test
(event.change);
Copy link to clipboard
Copied
try this:
event.rc=/^[\w\-]*$/.test(event.change);
Look at this article:
https://www.pdfscripting.com/public/Pattern-Matching-with-Regular-Expressions.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
try this:
event.rc=/^[\w\-]*$/.test(event.change);
Look at this article:
https://www.pdfscripting.com/public/Pattern-Matching-with-Regular-Expressions.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Please disregard my question. I am good!
Copy link to clipboard
Copied
Interesting, cause I just provided the correct answer.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
You did provide the correct answer. I tested it to be certain. It was better than what i came up with. THANK YOU!

