Skip to main content
Participant
February 25, 2019
Answered

If statement Help

  • February 25, 2019
  • 1 reply
  • 378 views

Hello all

I am need to using Acrobat for calculations and I am look for some help with an if statement this is what I am trying to do

I have an input box and I need to take what ever is put into that box and calculate and show that in the secound box, but I need it to not show anything in the second box if nothing is put in the first box. I hope this makes sense, this is the jave script I have and the calculation works but it will still do a calculation in no number is in the first box

these are the 2 boxes

in the calculation I have this script

event.value=((-(+this.getField("Input").value/3-6000)*(1.052-0.7778)/100))

Any help would be great and thanks in advance

This topic has been closed for replies.
Correct answer try67

Change your code to this:

var v = this.getField("Input").valueAsString;

if (v=="") event.value = "";

else event.value=((-(Number(v)/3-6000)*(1.052-0.7778)/100));

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 25, 2019

Change your code to this:

var v = this.getField("Input").valueAsString;

if (v=="") event.value = "";

else event.value=((-(Number(v)/3-6000)*(1.052-0.7778)/100));