Copy link to clipboard
Copied
Hi.
I'm trying to get certain fields for numbers only and certain others for letters only. When I open Text Field Properties, there is no option for numbers or letters only. Really stuck! (also, don't have a clue where or how to do coding if needed...!)
Thanks!
Copy link to clipboard
Copied
This can be done using a custom Keystroke script.
For example, this one will only allow numbers:
event.rc = /^\d*$/.test(AFMergeChange(event));
And this one will only allow letters (both lower and upper case):
event.rc = /^[a-z]*$/i.test(AFMergeChange(event));
Copy link to clipboard
Copied
This is nearly perfect for me. I would like to use event.rc = /^[a-z]*$/i.test(AFMergeChange(event)); but also allow for a space. My intent is to use the code in a "City" field. Some cities, like San Francisco, require a space between two words/letters. Is this possible?
Copy link to clipboard
Copied
Thank you, but I'm not sure how to do this.
How do I apply a custom keystroke script?
Copy link to clipboard
Copied
Right-click the field in Form Edit mode, select Properties, Format, Custom and then click on Edit next to Custom Keystroke Script and paste the code into the window that opens.
It's possible that after you do that the selection will revert back to None. That's OK. Just click on Close and it should work.
Copy link to clipboard
Copied
Thank you for your quick reply. Much appreciated.
.... Problem is, when I go into Properties, I only have 4 tabs, (General, Appearance, Position and Options)! (No Format option!)
Copy link to clipboard
Copied
Click on Tools - Prepare Form and then click on "More" at the right side of the window and then on "Revert to Acrobat Form".
Copy link to clipboard
Copied
YOU ARE A CHAMPION! THANK YOU!
Thanks for your patience and quick replies. Have a great day!