Skip to main content
arielreyes01
Participant
October 25, 2018
Answered

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

  • October 25, 2018
  • 1 reply
  • 1091 views

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

This topic has been closed for replies.
Correct answer George_Johnson

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.

1 reply

George_JohnsonCorrect answer
Inspiring
October 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.

arielreyes01
Participant
October 29, 2018

Worked perfectly, thank you!!!