if then statement to set numeric value

New Here ,
Jun 13, 2018

Copy link to clipboard

Copied

I need a script for a .pdf form that if the value of another field is zero this field will be zero, if not the field will become the value of a third field.

i.e.  if Q = 0 then P = 0 else P = U

TOPICS
Acrobat SDK and JavaScript

Views

83

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

if then statement to set numeric value

New Here ,
Jun 13, 2018

Copy link to clipboard

Copied

I need a script for a .pdf form that if the value of another field is zero this field will be zero, if not the field will become the value of a third field.

i.e.  if Q = 0 then P = 0 else P = U

TOPICS
Acrobat SDK and JavaScript

Views

84

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
Jun 13, 2018 0
BarlaeDC LATEST
Adobe Community Professional ,
Jun 14, 2018

Copy link to clipboard

Copied

Hi,

var Q = this.getField("Q");

var P = this.getField("P");

var U = this.getField("U");

if ( Q.value === 0)

{

     P.value = 0;

}

else

{

    P.value = U.value;

}

I would put this in the validate or calculate section of the Q field, as that is the one that is actually controlling the code.

Help This helps

Malcolm

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
Reply
Loading...
Jun 14, 2018 0