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

Help with calculator function in PDF form

New Here ,
Dec 19, 2024 Dec 19, 2024

Copy link to clipboard

Copied

Attached is a simple calculator with a formula for savings and product volume.

I would like to know how to use javascript to calculate off the text box input and off variables in the background as seen in the sheet. Ideally in the PDF- it would be spend text box 1 (b3), volume text box 2 (b5) and then the final result text box (b11-13). Just would like some guidance based off the excel formula and thanks!

TOPICS
How to , JavaScript , Modern Acrobat , PDF , PDF forms , Standards and accessibility

Views

113

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 ,
Dec 19, 2024 Dec 19, 2024

Copy link to clipboard

Copied

You can create hidden fields and set the default values to fields you don't want to show (Variable, Monthly Spend, Annual Spend) but it is not necessary if 1.65 is not going to change.  You can write the entire calculation in the Total Savings field.  Assume you have to fields named "Spend" (formatted as a 2-decimal number) and "Volume" (formatted as a percentage - both names are case sensitive).  Here's the custom calculation script that would go in the Total Savings field:

var spend=this.getField("Spend").value;
var volume=this.getField("Volume").value;
event.value=((spend/1.65)*12*volume*0.085)+(spend*(1-volume))*.05;

 

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
Community Expert ,
Dec 20, 2024 Dec 20, 2024

Copy link to clipboard

Copied

LATEST

- Wrong post, sorry -

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