Skip to main content
Participant
December 20, 2017
Answered

Question about custom button triggers and actions.

  • December 20, 2017
  • 1 reply
  • 547 views

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 has been closed for replies.
Correct answer Thom Parker

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

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 20, 2017

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