Skip to main content
Participating Frequently
February 17, 2024
Question

Value is not updated

  • February 17, 2024
  • 1 reply
  • 2201 views

Hello, I am creating a form and have a problem with the calculation of a value. The formula does not update.

 

The value to be calculated is in the field:
"SUM monthly amount"

 

The formula is:
var sum = +getField("SUM monthly amount").value *12/52;
if (sum !== 0) {
event.value = sum;
} else {
event.value = "";
}

 

The first time I fill in the field, the calculation is performed, but as soon as I change the value in the field "SUM monthly amount", the value to be calculated is not updated.

All other calculations work and are also updated.

Translated with www.DeepL.com/Translator (free version)

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
February 17, 2024

Is this code placed in the custom calculation script for a field other than "SUM monthly amount"?

Try this small fixup:

 

var sum = this.getField("SUM monthly amount").value *12/52;
if (sum != 0) {
   event.value = sum;
} else {
   event.value = "";
}

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
web&wowAuthor
Participating Frequently
February 17, 2024

Hi Thom, thank you very much, but that didn't solve the problem.

try67
Community Expert
Community Expert
February 17, 2024

Does the other field also have a calculated value?

Did you check the JS Console for error messages?