• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If statement Help

New Here ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

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

input.PNG

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

TOPICS
Acrobat SDK and JavaScript

Views

251

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

correct answers 1 Correct answer

Community Expert , Feb 25, 2019 Feb 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));

Votes

Translate

Translate
Community Expert ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

LATEST

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));

Votes

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