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.
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
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?
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?
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 :