Skip to main content
New Participant
January 23, 2022
Question

Conditional statement in pdf

  • January 23, 2022
  • 1 reply
  • 2272 views

I'm trying to create a pdf form where one field value is calculated by the other but I can't seem to figure out how to make it work. Can you please assist?

 

For example:

A person enters a number in Field 1 that is between 0 and 10

Field 2 populates a number based off of that input.

A person enters a number in Field 1 that is between 11 and 20

Field 2 poputlates a different number based off of that input.

 

 

 

 

 

 

This topic has been closed for replies.

1 reply

New Participant
January 23, 2022
Conditional_Statement_in_pdf_file.pdf
Thom Parker
Inspiring
January 23, 2022
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
New Participant
January 24, 2022
Thanks! I was able to get it to work; however, I'm having trouble with
conditional statements using drop down list values now .

Below is my syntax

CGBddl is a drop down list... two of the choices are Manager and Director

What I want to happen is when a person selects the rank from the drop down
list, the value of a field = a static value (CVCT) multiplied by the % that
aligns with the rank selection. The only thing that is happening right now
with the script is the CVCT field is being multiplied by

var CGBddl = this.getField("CGBddl").value;
var CVCT = this.getField("CVCT").value;
if( CGBddl = "Manager" ) {event.value = CVCT * 0.04; }
if( CGBddl = "Director" ){event.value = CVCT * .06; }


Can you please assist by providing me some direction on how to get this
script to work properly?

Thanks! David