Conditional statement in pdf

New Here ,
Jan 23, 2022 Jan 23, 2022

Copy link to clipboard

Copied

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.

 

 

 

 

 

 

TOPICS
Windows

Views

92

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 23, 2022 Jan 23, 2022

Copy link to clipboard

Copied

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 23, 2022 Jan 23, 2022

Copy link to clipboard

Copied

Read This:

https://www.pdfscripting.com/public/How-to-Write-a-Basic-PDF-Calculation-Script.cfm

and this:

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

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 24, 2022 Jan 24, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 24, 2022 Jan 24, 2022

Copy link to clipboard

Copied

In JS the comparison operator is "==" (or "===").

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

LATEST

Yes, thank you!

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines