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

Please Help! Hide / Show Acrobat field when a seperate field is populated/

New Here ,
Apr 20, 2020 Apr 20, 2020

Copy link to clipboard

Copied

I'm still a newbie with forms and I've tried to look at all the posts to find an asswer but it's all latin to me.

I would like to show/hide a field when a seperate field is filled.

Ex. Field "A" is empty = Field "B" is hidden.

       Field "A" is filled = Field "B" is showing.

Field A is a manually entered field. Field B is read-only.

I know this is easy task probably for most PDF form builders but I'm only a few weeks in. Any help is much appreciated.

Cliff

TOPICS
Acrobat SDK and JavaScript

Views

93

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

Community Expert , Apr 21, 2020 Apr 21, 2020

Use this:

event.value = Number(this.getField("A1").valueAsString) * Number(this.getField("A2").valueAsString) * Number(this.getField("A3").valueAsString) ;

event.target.display = (this.getField("A").valueAsString=="") ? display.hidden : display.visible;

Likes

Translate

Translate
Community Expert ,
Apr 20, 2020 Apr 20, 2020

Copy link to clipboard

Copied

As the custom calculation script of field B enter the following code:

event.target.display = (this.getField("A").valueAsString=="") ? display.hidden : display.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
community guidelines
New Here ,
Apr 20, 2020 Apr 20, 2020

Copy link to clipboard

Copied

Hi

 

I forgot to mention that B is part of a calculation so I already have a calculation in "B". I'll explain in detail.

A1 x A2 x A3 = B
"A" fields are user entered fields. "B" is read only

"B" field is only shown when a number is entered in any of the "A" fields. If all "A" fields are blank then "B" is hidden.

 

Hope that makes sense. I tried putting the code in calculation script just realized there was already a calculation.
I tried putting it in the validation area but it's not working.

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

Copy link to clipboard

Copied

Use this:

event.value = Number(this.getField("A1").valueAsString) * Number(this.getField("A2").valueAsString) * Number(this.getField("A3").valueAsString) ;

event.target.display = (this.getField("A").valueAsString=="") ? display.hidden : display.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
community guidelines
New Here ,
Apr 21, 2020 Apr 21, 2020

Copy link to clipboard

Copied

LATEST

Amazing! Thank you try67

Work perfectly!

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