Skip to main content
Participant
July 11, 2023
Question

Creating a layered fillable form

  • July 11, 2023
  • 2 replies
  • 615 views

I am trying to create a form that will have a field with two options, and when one option is selected it will trigger one type of form, and when another option is selected it will trigger the other type of form.  I need to make sure that both form types are only visible when that option is selected, as they are being used for different purposes.  Is this possible?  If so, is there anyone who can guide me on how to do this?  

This topic has been closed for replies.

2 replies

JR Boulay
Community Expert
Community Expert
July 12, 2023

Beware of the fact that the visible/invisible state of a layer is not memorised (neither by Acrobat nor by any other software).
It is up to you to use JavaScript to memorise their state when you close the PDF and to restore these states when you reopen the PDF.

That's why it's often more practical to show/hide fields or use template pages.

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
July 11, 2023

Yes, you can use a script to show/hide fields, as well as layers (in case you need to show/hide static elements too, like images, graphics and text). However, this won't work if the file is used on a mobile device or in an application that doesn't support scripting properly, so take that into account before spending a lot of time and effort on it...

Participant
July 12, 2023

Thank you so much for this!  Do you know where I might find instructions/guidance on how to do this?

try67
Community Expert
Community Expert
July 12, 2023

To learn how to show/hide fields see:

https://acrobatusers.com/tutorials/show_hide_fields

Also see:

https://acrobatusers.com/tutorials/conditional-execution

Showing/hiding layers is a bit more complicated. You need to access them via the getOCGs method, search for the specific layer in the array, and then change its state property.