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
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;
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;
Copy link to clipboard
Copied
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.
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;
Copy link to clipboard
Copied
Amazing! Thank you try67
Work perfectly!