Skip to main content
Inspiring
September 30, 2023
Question

Script not returning expected values

  • September 30, 2023
  • 1 reply
  • 746 views

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

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 30, 2023

Change:

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

To:

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

rsbisaAuthor
Inspiring
October 1, 2023

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.