• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Disabling the paste function in a text field

Community Beginner ,
Feb 24, 2016 Feb 24, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

713

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 24, 2016 Feb 24, 2016

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.

Likes

Translate

Translate
LEGEND ,
Feb 24, 2016 Feb 24, 2016

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 24, 2016 Feb 24, 2016

Copy link to clipboard

Copied

If that is something I can setup easily that would be fine.

Thanks.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2016 Feb 24, 2016

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 24, 2016 Feb 24, 2016

Copy link to clipboard

Copied

Thank you very much.  That works fine for what I need to do.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2020 Apr 19, 2020

Copy link to clipboard

Copied

LATEST

Awesome - thank you 🙂

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines