Copy link to clipboard
Copied
Trying to create a form, where if they check "Yes" or unchecking of "Yes" would also erase/hide the "A_Comments" box.
My issue is; if I uncheck "yes" the A_Comments field remains visible. Checking "No" does hide and blanks out any content.
I have the following code on the "Yes":
this.getField("A_Comments").display=display.visible;
and this on the "No":
this.getField("A_Comments").display=display.hidden
"A_Comments" field has the following text Field Properties:
Properties/General/Form Field: Hidden
Any help would be appreciated.
Regards,
Copy link to clipboard
Copied
Trying to create a form, where if they check "Yes" or unchecking of "Yes" would also erase/hide the "A_Comments" box.
My issue is; if I uncheck "yes" the A_Comments field remains visible. Checking "No" does hide and blanks out any content.
I have the following code on the "Yes":
this.getField("A_Comments").display=display.visible;
and this on the "No":
this.getField("A_Comments").display=display.hidden
"A_Comments" field has the following text Field Properties:
Properties/General/Form Field: Hidden
Any help would be appreciated.
Regards,
Copy link to clipboard
Copied
Read this article:
https://acrobatusers.com/tutorials/show_hide_fields
It has exactly what you need
Copy link to clipboard
Copied
Thanks for the link. A lot of reading, but was able to find the code needed for my issue.
Copy link to clipboard
Copied
I knew you'd find it there! And now you know more about how Acrobat fields and scripts work. My work is done
Copy link to clipboard
Copied
Use the following script :
In "yes" :
if (event.value == "Yes"){
this.getField("A_Comments").display=display.visible;}
else
{this.getField("A_Comments").display = display.hidden;}
In "No":
if (event.value == "No"){
this.getField("A_Comments").display=display.hidden;}
else
{this.getField("A_Comments").display = display.visible;}
Copy link to clipboard
Copied
Thanks, the behavior is not correct. Unchecking the "Yes" box did not hide the "A_Comments" field.
So, I used the following in the "YES" Box:
var nHide = event.target.isBoxChecked(0)?display.visible:display.hidden;
this.getField("A_Comments").display = nHide;
Clicking "yes" , on and off, would display and hide the "A_Comments" fields.
For "No", a plain checkbox works. As the above solved the display issue.
Thanks, rakeshk21205956