0
Javascript Calculation multiply field and add previous
New Here
,
/t5/acrobat-discussions/javascript-calculation-multiply-field-and-add-previous/td-p/14814800
Aug 21, 2024
Aug 21, 2024
Copy link to clipboard
Copied
Means: Acrobat PDF Fillable Form.
I want to make a TEXT FIELD called "Results" that takes a Value in another (seperate) TEXT FIELD, called "Amount" and multiplies that field it by "5" and then compounds/adds to all previous values...
Example:
Amount is multiplied by 5 (1x5=5; 2x5=10; 3x5=15; 4x5=20, and so on)
Thus if "1" is in the field, the "Results" is 5, but if 2 is in the "Amount" field the "Results" would be 15 (5 + 10), and 3 would be 30 (5+10+15), and so on.
Anyone know how to code this?
TOPICS
Create PDFs
,
JavaScript
,
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/acrobat-discussions/javascript-calculation-multiply-field-and-add-previous/m-p/14814926#M475928
Aug 21, 2024
Aug 21, 2024
Copy link to clipboard
Copied
Try something like this as 'Validate' script of "Amount" field:
if(!isNaN(event.value))
this.getField("Results").value += Number(event.value)*5;
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

