Skip to main content
Participant
March 6, 2019
Answered

javascript in acrobat

  • March 6, 2019
  • 2 replies
  • 692 views

Im trying to work on an if statement for calculations in a doc.

I have a basic knowledge of scripting but it has been a while since ive done any and Im having a hard time tracking down a command

What I am trying to do is when a number is entered into a editable box in the document and its value is less than a known amount, it will auto fill a box else where in the document where it will then be subject to calculations. if it is higher than that amount it will be sent to a different box where it will be subject to a different set of calculations.

I believe I have everything worked out except for the command that will set the value and autofill the box further down in the document.

Can someone give me direction on this?

Thank you

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

If indeed just the filling of a form field is missing from your script, that is easy. Let's assume you want to assign a value to the field "SampleField", then you would do the following:

this.getField("SampleField").value = 100;

You can of course use a calculation to determine the value you are assigning to the field. If you need to learn about JavaScript in general, take a look here: Learning to Program JavaScript for Adobe Acrobat - KHKonsulting LLC

2 replies

Karl Heinz  Kremer
Community Expert
Karl Heinz KremerCommunity ExpertCorrect answer
Community Expert
March 6, 2019

If indeed just the filling of a form field is missing from your script, that is easy. Let's assume you want to assign a value to the field "SampleField", then you would do the following:

this.getField("SampleField").value = 100;

You can of course use a calculation to determine the value you are assigning to the field. If you need to learn about JavaScript in general, take a look here: Learning to Program JavaScript for Adobe Acrobat - KHKonsulting LLC

Legend
March 6, 2019

Please show us

1. All the script you have

2. Exactly which action(s) you put it on for which field(s)

3. Any error messages you get in the console

We prefer to help you understand what is wrong and fix what you have, to writing it for you.