JavaScript
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
See this article:
https://acrobatusers.com/tutorials/create_use_layers/
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thanks, I will check it out. Giving myself a "brain break" for the day. Will try it tomorrow morning and let you know.

