0
Divide with an if statement
New Here
,
/t5/acrobat-discussions/divide-with-an-if-statement/td-p/13576966
Feb 13, 2023
Feb 13, 2023
Copy link to clipboard
Copied
I am trying to divide with an if statement.
If "Field A" = "x" divide "Field B" by "#"
if "Field A" = "y" divide "Field B" by "1" or do nothing.
TOPICS
General troubleshooting
,
How to
,
JavaScript
,
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/acrobat-discussions/divide-with-an-if-statement/m-p/13577084#M399152
Feb 13, 2023
Feb 13, 2023
Copy link to clipboard
Copied
You'll need to use a custom script. I'm assuming this is for a calculation.
var oFldA = this.getField("Field A");
var oFldB = this.getField("Field B");
if(oFldA.value == "x")
event.value = oFldB.value/#;
else
event.value = oFldB.value;
Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often
Use the Acrobat JavaScript Reference early and often
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

