• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Make specific text fields read only using a button

Participant ,
Apr 28, 2020 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

3.2K

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
Community Expert ,
Apr 29, 2020 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

Votes

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
Participant ,
Jun 18, 2020 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?

Votes

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

LATEST

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?

Votes

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
Community Expert ,
Apr 29, 2020 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

 

Votes

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