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

How can I use a button to toggle readonly state of field?

New Here ,
Oct 25, 2018 Oct 25, 2018

Copy link to clipboard

Copied

I have a field called "MileageRate". I would like that field to toggle between read-only and "read-write" when clicking a button. This way, each year that the mileage rate changes I can just enter the new rate, then make read-only again without having to actually use the "prepare form" functionality of acrobat to make that change. Is there a javascript I can use for that? I don't have any sample to enter here because I don't know how to write javascript... but I've become quite talented at copying and pasting .

Any help is appreciated, thanks!

Ariel

TOPICS
Acrobat SDK and JavaScript , Windows

Views

825

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 , Oct 25, 2018 Oct 25, 2018

The Mouse Up script for a button could be:

// Get a reference to the text field

var f = getField("Text1");

// Toggle the read-only property

f.readonly = !f.readonly;

Replace "Text1" with the actual name of the text field.

Votes

Translate

Translate
LEGEND ,
Oct 25, 2018 Oct 25, 2018

Copy link to clipboard

Copied

The Mouse Up script for a button could be:

// Get a reference to the text field

var f = getField("Text1");

// Toggle the read-only property

f.readonly = !f.readonly;

Replace "Text1" with the actual name of the text field.

Votes

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 ,
Oct 29, 2018 Oct 29, 2018

Copy link to clipboard

Copied

LATEST

Worked perfectly, thank you!!!

Votes

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