Skip to main content
Participant
April 29, 2020
Question

Script If/or Formula for Dealing with Blanks

  • April 29, 2020
  • 2 replies
  • 374 views

I am brand new to Java, almost no experience.

 

I need help with a custom script to reference Field 1.  Field1 is a drop-down list with 3 options (1. is a space as default, 2. "Yes", 3. "No")

In Field 2, look at Field 1 and if blank (or space to look blank), leave Field 2 blank (or space to look blank).

If Field 1 says "Yes", Leave Field 2 blank (or space to look blank).

If Field 1 says "No", Field 2 says "N/A"

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
April 30, 2020

What you're asking about is a slightly complicated calculation. You'll need to learn a bit about how scripting works in Acrobat, as well as how to write "if" statements.

Here are a couple of relevant articles:

https://www.acrobatusers.com/tutorials/conditional-execution/

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
JR Boulay
Community Expert
Community Expert
April 30, 2020

See this demo file: https://documentcloud.adobe.com/link/track?uri=urn%3Aaaid%3Ascds%3AUS%3A6b8a6d26-0771-4f4e-a99b-90ec9762e1da

 

The JavaScript (and not Java) is a calculation script in the text field, which use the Export Values of the dropdown.

Acrobate du PDF, InDesigner et Photoshopographe