Highlighted

Make specific text fields read only using a button

Explorer ,
Apr 28, 2020

Copy link to clipboard

Copied

Hi, I have an order form. I have added calculations in this form. Now I am allowing customers to only enter qty then price will auto calculated.

 

 All values other than qty are read only. Is there a way that I can do visible or read only specific fields using a button?

 

So I can change the amount in order form then I can again make those fields read only using button.

 

Hope this is possible.

 

 

Topics

PDF forms

Views

113

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

Make specific text fields read only using a button

Explorer ,
Apr 28, 2020

Copy link to clipboard

Copied

Hi, I have an order form. I have added calculations in this form. Now I am allowing customers to only enter qty then price will auto calculated.

 

 All values other than qty are read only. Is there a way that I can do visible or read only specific fields using a button?

 

So I can change the amount in order form then I can again make those fields read only using button.

 

Hope this is possible.

 

 

Topics

PDF forms

Views

114

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
Most Valuable Participant ,
Apr 29, 2020

Copy link to clipboard

Copied

Sure. You can do it using this code:

this.getField("FieldName").readonly = true; // make a field read-only

this.getField("FieldName").display = display.visible; // make a field visible

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...
Explorer ,
Jun 18, 2020

Copy link to clipboard

Copied

1.How is this possible to apply this for more than one text field. I have almost 10 fillable fields. 

2. Is this possible to apply this code on single button. One first click all fields are read only and on second click all fields are writeable.

3. If not possible on button then may be it is possible with check box?

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...
try67 LATEST
Most Valuable Participant ,
Jun 18, 2020

Copy link to clipboard

Copied

1. Duplicate the lines, adjusting the field name in the quotes each time.

2. Sure, you can place all of that code under the same script. So you want to toggle the fields read-only property only, or also their visibility?

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...
Adobe Community Professional ,
Apr 29, 2020

Copy link to clipboard

Copied

Hi,

 

use something like this:

 

var f = this.getField("myTextField");
f.value = "You can’t change this message!";
f.readonly = true;

 

The example above is from the

 

Adobe Acrobat SDK New Features and Changes
JavaScript™ for Acrobat® API Reference   "Field properties"  page 399

 

See slide below to get an idea of how employ it with an action for example :

 

ACTION WIZARD.png

 

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...
Resources
One Stop Solution for Acrobat
Edit a PDF