Skip to main content
Participant
Dec 20, 2017 8:47 PM UTC
Answered

Question about custom button triggers and actions.

I want a button to do this:

1) With single click on Field1 - hide Field1 and show Field2

2) With single click on Field2 - hide Field 2 and show Field1

3) With double click on Field1 - open a file

Basically, I want to show and hide images throughout a PDF. I want the option between having the image appear on the document and being able to open the image in a new window.

Any help? I very new to Javascript and cannot figure it out.

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Dec 20, 2017 9:57 PM UTC

Hiding and showing fields is easy. But there is no double click event, so it has to be implemented as a script.

So here is code for the mouseUp on Field1:

this.getField("Field2").hidden = false;

event.target.hidden = true;

Here is the code for the mouseup on Field2

this.getField("Field1").hidden = false;

event.target.hidden = true;

double click detection is outside the scope of this thread

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Dec 20, 2017 9:57 PM UTC

Hiding and showing fields is easy. But there is no double click event, so it has to be implemented as a script.

So here is code for the mouseUp on Field1:

this.getField("Field2").hidden = false;

event.target.hidden = true;

Here is the code for the mouseup on Field2

this.getField("Field1").hidden = false;

event.target.hidden = true;

double click detection is outside the scope of this thread

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often