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

Fairly simple calculation script and subsequent error

Community Beginner ,
Sep 03, 2018 Sep 03, 2018

Copy link to clipboard

Copied

Hi You fantastic debugger/educators!

Here is my script:

var vsupplycfm = Number(this.getField("SupplyCFMcalc").valueAsString);

var vexhaustcfm = Number(this.getField("iftheninflow").valueAsString);

var vnozzle = Number(this.getField("Nozzledropdown").valueAsString);

event.value = (13500*vnozzle) / (vsupplycfm+vexhaustcfm);

its a fairly simple calculation I want to run at the end.  And here is what the javascript debugger says:

Exception in line 3 of function top_level, script Field:Calculate

TypeError: this.getField(...) is null

3:Field:CalculateException in line 1 of function top_level, script Field:Calculate

TypeError: this.getField(...) is null

1:Field:Calculate

But the other fields are working and have numbers in them and are not null. I checked spelling , capitals etc seem correct.

TOPICS
Acrobat SDK and JavaScript

Views

143

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
LEGEND ,
Sep 03, 2018 Sep 03, 2018

Copy link to clipboard

Copied

LATEST

Check again. Try copying & pasting the field names from the field properties dialog into the JavaScript editor.

You should also check that the denominator (vsupplycfm+vexhaustcfm) does not evaluate to zero before attempting the division, which will happen if both of those fields are blank.

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