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

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

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

320

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

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

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

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

321

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

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
Reply
Loading...
Oct 25, 2018 1
Oct 29, 2018

Copy link to clipboard

Copied

Worked perfectly, 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
Reply
Loading...
Oct 29, 2018 0