Skip to main content
Participant
March 25, 2024
Question

JavaScript

  • March 25, 2024
  • 2 replies
  • 537 views

Hi! I am working on a project in Acrobat Pro. I need a button to show a layer if two other text field entries don't match. So, basically - On click if text field 1 does not equal text field 2 then show layer "Alert" 

I am thinking it can be done using JavaScript, I just don't know how to write it.

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
March 25, 2024
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
March 25, 2024

Thanks. I understand how to make a layer - I currently have the layer on the page. I have a button that when clicked will show or hide it. I need to add conditions that when that button is pushed if text field 1's contents do not equal text field 2's contents then show layer "Alert" - that is why I think I need a javascript.

Thom Parker
Community Expert
Community Expert
March 25, 2024

The article explains how to use JavaScript to show/hide layers. 

To add conditions to the script, read this article.

https://www.pdfscripting.com/public/How-to-write-an-If-statement.cfm?sd=40

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Amal.
Community Manager
Community Manager
March 25, 2024

Hi @jamiep59794486 

Hope you are doing well and thanks for reaching out.

The workflow you are trying to achieve is might be possible using JavaScript. For more information, please check the help pages listed below:
https://acrobatusers.com/tutorials/javascript_console/
https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

Hope it will help

Regards
Amal