Copy link to clipboard
Copied
I have 30 layers that I created in InDesign and exported to PDF (multiple pages). I created a dropdown menu with corresponding item lists. I want to be able to show only the layer selected from the dropdown list (plus keep the main header layer active at all times). I found this post that almost worked for me, but it kept previously selected layers active once I changed the selection. I need the the other layers to hide if the selection changes. Thank you for your time, and please take it easy on me, this is my first attempt at Javascript!
That code should have worked in your case... Try this version of it, instead:
var ocgs = this.getOCGs();
if (ocgs) {
for (var i in ocgs) {
ocgs.state = (ocgs.name==event.value);
}
}
Place this code as the custom validation script of the drop-down field and make sure to tick the option to commit the selected value immediately (under the Options tab).
Copy link to clipboard
Copied
That code should have worked in your case... Try this version of it, instead:
var ocgs = this.getOCGs();
if (ocgs) {
for (var i in ocgs) {
ocgs.state = (ocgs.name==event.value);
}
}
Place this code as the custom validation script of the drop-down field and make sure to tick the option to commit the selected value immediately (under the Options tab).
Copy link to clipboard
Copied
Thank you! Is there any way to make one of the 30 layers stay visible at all times?
Copy link to clipboard
Copied
Sure. You can add something like this before line #4 above:
if (ocgs.name=="Layer0") continue;
Copy link to clipboard
Copied
You have just remedied hours of searching and trial/error on my end. Much appreciated.