Skip to main content
Participant
November 21, 2017
Question

How do I reference a text field in a javascript calculation

  • November 21, 2017
  • 1 reply
  • 481 views

How do I reference a text field in a javascript calculation, example: var HR = (55-20); event.value=Math.pow(HR,0.54); Where 55 references a Field name?

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
November 21, 2017

the "this.getField()" function is used to acquire a field object. The field object has the value as well as all the other properties of the field.

Here's an article that dicusses some of the details of calculations.  Be sure to check out the sample file

https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Here's a web page with lots of info about performing calculations

Calculating field values and more

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often