Copy link to clipboard
Copied
I'm creating a pdf that will show the same stats for different subcontractors.
I would like to have all the subcontractor names in a drop down menu. When a subcontractor's name is chosen, a layer will be turned on that consists of a text field with the sub's stats.
All of the different subcontractor text fields will be located in the same place on the pdf, each with it's own layer. So that when a sub is chosen his layer is made visible and all of the rest are made invisible, until their name is chosen on the drop down menu.
Can this be done by adding script to the custom validation window under the drop down menu's properties section? If so, does anyone know what that script would be?
Copy link to clipboard
Copied
Are these actually text fields or just text on the page. Text fields can be assigned to layers in PDF but there's no mechanism in Acrobat to do it. You'll need a plugin to set that up. If it's just text on (in?) a layer, then you can see code to do that sort of thing at the link below.
turn layers (OCG) on or off denpending on the resulat of a calculation (JavaScript)
Copy link to clipboard
Copied
Good distinction. I spoke incorrectly. These are not "text fields", it's just text on the page. Sorry about that.
So I looked at the link you provided and I get how that would work if the use was entering a number in, but what if I'm using a drop down menu with names instead? Do i assign each name a number in the "export value" box and do it that way?
Thanks for the help btw.
Copy link to clipboard
Copied
You may find the coding easier if you set the export values in the list to correspond numerically to the index number of the OCGs in the array but any programming trick that will allow you to associate a value in the list to a certain layer name or index value should work.
For this sort of thing, I tend to put the script that does the work in a custom format script. That's generally not what the format script is used for but I use it because it's always the last event to get triggered before the user exits the field. You wouldn't modify the format of the field in your code, you'd just change the layer properties.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now