Copy link to clipboard
Copied
I am creating a PDF form and am wanting to restrict the user so they cannot paste text from another source into a text field on the form. Is this possible?
I am using Acrobat Pro DC.
Thanks.
The custom keystroke script (Text Field Properties dialog > Format tab > Custom format category > Custom Keystroke Script) can be as simple as:
event.rc = event.change.length < 2;
The problem is if you need to do this for fields that use one of the built-in formatting categories (e.g., Number or Date), then it gets more complicated.
Copy link to clipboard
Copied
In a keystroke script you can reject anything that's more than a single character, as would happen if multiple characters were pasted. This would still allow the user to paste a single character at a time. Would that be OK?
Copy link to clipboard
Copied
If that is something I can setup easily that would be fine.
Thanks.
Copy link to clipboard
Copied
The custom keystroke script (Text Field Properties dialog > Format tab > Custom format category > Custom Keystroke Script) can be as simple as:
event.rc = event.change.length < 2;
The problem is if you need to do this for fields that use one of the built-in formatting categories (e.g., Number or Date), then it gets more complicated.
Copy link to clipboard
Copied
Thank you very much. That works fine for what I need to do.
Copy link to clipboard
Copied
Awesome - thank you 🙂
Copy link to clipboard
Copied
I see how this works, but when I tried on my document I found that I could only access the format tab when a single field is selected. Is there a way to do this for an entire document at once, or at least an entire page at once?
Copy link to clipboard
Copied
Yes, you can write a console script to apply the custom keystroke to a whole set of fields all at once.
Read this.
https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm?sd=40#JScript