Copy link to clipboard
Copied
I enter into one field a dollar amount. Then a second field auto populates with 2.5% of that number in first field.
Copy link to clipboard
Copied
First, you need to understand the math.
What you want is this, correct?
B = .025 * A
So your code needs to be placed in the calculation script for field B.
event.value = this.getField("A").value * 0.025;
You can learn more about JavaScript and calculations here:Calculating field values and more
And you'll find an example PDF with calculations here (about halfway down the page):Free Sample PDF Files with scripts
Copy link to clipboard
Copied
Have you a question?
Copy link to clipboard
Copied
Sorry, guess it was the way I formed it.
If I type a dollar amount into field A, I want it to calculate 2.5 % of that amount and put it in field B. How is this done. I tried this, but does not work.
event.value = Number(this.getField("A").value) * (Number(this.getField("B").value)/2.5);
Copy link to clipboard
Copied
First, you need to understand the math.
What you want is this, correct?
B = .025 * A
So your code needs to be placed in the calculation script for field B.
event.value = this.getField("A").value * 0.025;
You can learn more about JavaScript and calculations here:Calculating field values and more
And you'll find an example PDF with calculations here (about halfway down the page):Free Sample PDF Files with scripts
Copy link to clipboard
Copied
I understand what I want, just not sure of syntax. What you gave me is 100% perfect. Plus the link you sent, very helpful. Thank you.
Now, go buy a lotto ticket and win BIG!!!!
Copy link to clipboard
Copied
You can use this simplified notation:
0.025 * A
Copy link to clipboard
Copied
even better