Read only button toggle

New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Hello all,

I'm trying to make a fillable form where the front desk reps fill out a certain portion of the form and then the form is sent to patients to sign and fill out. To avoid patients from editing what the front desk has filled out im trying to make a button that locks the fields to read only. I have the code to set the text field to read only but I would like the text fields to be editable again if the button is unchecked in case the front desk needs to go back and fix something. Is this possible? The code I have for the button to set it to read only is this.getField("FieldNameHere").readonly = true;

 

Thank you for any help!

TOPICS
JavaScript, PDF forms

Views

77

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

Most Valuable Participant , Mar 17, 2021 Mar 17, 2021
Assuming it's a check-box field, and you've placed the script udner its Mouse Up event, you can adjust your code like this: this.getField("FieldNameHere").readonly = (event.target.value!="Off");

Likes

Translate

Translate
Most Valuable Participant ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Assuming it's a check-box field, and you've placed the script udner its Mouse Up event, you can adjust your code like this:

 

this.getField("FieldNameHere").readonly = (event.target.value!="Off");

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 ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Yes, it is a check-box field. Aplogies I should have been more clear. This 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
community guidelines
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Thank you for your help. I just have one more question. Is there a code that locks that check box button after it has been saved? 

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
Most Valuable Participant ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

LATEST

What has been saved? The file? If so, you should do it just before it's saved, not after.

To do it go to Tools - JavaScript - Set Document Actions and under the Document Will Save event enter the following code:

this.getField("FieldNameHere").readonly = true;

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