Skip to main content
Participant
April 20, 2020
Answered

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

  • April 20, 2020
  • 1 reply
  • 718 views

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

This topic has been closed for replies.
Correct answer try67

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;

1 reply

try67
Community Expert
Community Expert
April 20, 2020

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

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

Participant
April 20, 2020

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.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
April 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;