• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Javascript Calculation multiply field and add previous

New Here ,
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

Views

67

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2024 Aug 21, 2024

Copy link to clipboard

Copied

LATEST

Try something like this as 'Validate' script of "Amount" field:

if(!isNaN(event.value))
this.getField("Results").value += Number(event.value)*5;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines