What is the code to hide/show a button in Adobe PDF when clicking another button that's purpose is to shows/hides a layer?

I have a button that I edited the action to "run a JavaScript" under "Mouse Down."

This is the code I put into the JavaScript (Button is titled "Site External Doors"):

var docOCGs = this.getOCGs(); 
for (var x=0; x < docOCGs.length; x++) 
          if(docOCGs[x].name == "Site External Doors" ||
     docOCGs[x].name == "Site External Doors")
                    docOCGs[x].state = !docOCGs[x].state; 
// Button Style and Label Change 
if(event.target.borderStyle == border.b)
          // Perform Push Down Actions
          event.target.borderStyle = border.i;

          event.target.buttonSetCaption("Site External Doors Off");
} else {
          // Perform Pop Up Actions

          event.target.borderStyle = border.b;

          event.target.buttonSetCaption("Site External Doors On");

This code shows a layer when clicked and hides the layer when clicked again. I am wondering what code I need to add to get another button (titled "Door 52") to appear when the button "Site External Doors" is clicked and hide when it is clicked again.


Acroform buttons, like other fields, have a "display" property you can set. You should be able to set the "Door 52" button to be hidden on creation, then make it visible with code such as:

// Show the button
var door52 = getField("Door 52");
door52.display = display.visible;

// Hide the button again
door52.display = display.hidden;

Need Your Help

How to load a model from another module with CodeIgniter

codeigniter model module

Im using the HMVC extension with CodeIgniter and i got 2 modules

How to debug random data abort issue on arm based platform

c embedded arm

As developing on ARM based project, we get data abort randomly, that is when we play with it we get a data abort interrupt. But the data abort is not always on the same point when we check with the