7 Replies Latest reply on Nov 30, 2015 12:56 AM by try67

    javascript example for showing/hiding OCG layer in Acrobat DC

    tracyy42935226

      I have seen this question a couple of times but no sufficient answers, so I am going to ask a bit more specifically.

       

      I have a listbox with three different option (option 1 is "Blue", option 2 is "Green" and option 3 is "Yellow")

      The document has 3 corresponding layers named BlueLayer, GreenLayer and YellowLayer.

      When "Blue" is selected from the dropdown list, I would like BlueLayer to show (but not GreenLayer or YellowLayer).

      When "Green" is selected from the dropdown list, I would like GreenLayer to show (but not BlueLayer or YellowLayer).

      When "Yellow" is selected from the dropdown list, I would like YellowLayer to show (but not BlueLayer or GreenLayer).

       

      My theory is that if I select the box that says Commit Selected Value Immediately, I should be able to run a javascript on the MouseUp command that would allow the correct corresponding layer to show.

       

      Could someone show me an example of what this javascript would look like or suggest a better way of doing it?

       

      I know that Radio Buttons are another option, but ultimately, I prefer a list box due to the design of the form.

       

      BTW, I am new to using javascript in Adobe Acrobat so if I am totally off base with my thinking, please direct me in the right path.  Thank you in advance!!!!