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

Script not returning expected values

Contributor ,
Sep 30, 2023 Sep 30, 2023

I'm using Adobe Acrobat Pro,

Build: 23.3.20284.0

 

Experts, I'm struggling with the following script. In a PDF form, I'm trying to return the correct value to athe current field, baseHMONetTotal. The below does not return the value of i or t, it only returns the default value of 0.

 

// Get the values of the sumBaseHMOValue and baseHMOMOOP1 fields

 

var i = this.getField("sumBaseHMOValue").value;

var t = this.getField("baseHMOMOOP1").value;

var result = this.getField("bHMONetTotal").value;

// Compare i with t values

if (i > t) {

     result.value = t; }

else if (i < t) {

     result.value = i; }

TOPICS
JavaScript , Modern Acrobat , PDF forms
556
Translate
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
Community Expert ,
Sep 30, 2023 Sep 30, 2023

Change:

var result = this.getField("bHMONetTotal").value;

To:

var result = this.getField("bHMONetTotal");

Translate
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
Contributor ,
Oct 01, 2023 Oct 01, 2023
LATEST

Thank you. I was not able to get this to work. However, I was able to get it to work another way. The problem had to do with a format problem several layers back in the form. 

Translate
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