Skip to main content
Participating Frequently
Jul 14, 2016 5:54 PM UTC
Question

Auto-summing possible?

Is it possible to add numerical fields to a form that can auto-sum? For example, say I want to add 6 numerical fields/boxes to a form, then ask the user to input numbers into 5 of the fields, is there an option to direct the 6th box to be automatically populated with the total?

21 replies

JR Boulay
Community Expert
Community Expert
Apr 27, 2025 8:14 PM UTC

[MOVED TO THE ACROBAT DISCUSSIONS]

Translate
Acrobate du PDF, InDesigner et Photoshopographe
Participant
Apr 23, 2025 4:31 PM UTC

I have a question on Auto-summing and figured this is a good place to ask.

Can I combine auto-summing with validation?  For example,  new customers need to spend a 2k hookup fee but existing customers do not.   I want to use auto-summing to calculate the hookup fee and grand total for new customers using text fields, but do not want it to calculate the 2k hookup fee for existing customers.   Is that possible?

Translate
Legend
Apr 28, 2025 1:17 PM UTC

Hi @jessica_0941,

 

Thank you for reaching out. As you know, this most likely can be achieved with  

 

To meet your requirement, where the total field should only calculate based on newly entered values and not on pre-existing values, a standard field calculation (sum of fields) would not be sufficient.

You would need to use a custom JavaScript inside the form to control when and how the sum is calculated.

 

Here’s a basic example of how you could achieve this:

  1. Open your form in Adobe Acrobat (Standard or Pro).

  2. Go to the Prepare Form and select your fields.

  3. Right-click the “Total” field, choose Properties, and go to the Calculate tab.

  4. Select Custom Calculation Script, and enter a script similar to this:

// Example script
var f1 = this.getField("Field1");
var f2 = this.getField("Field2");
var f3 = this.getField("Field3");

var sum = 0;

// Check if the field was newly filled (example logic: not pre-populated or modified)
if (!f1.isDefaultValue) sum += Number(f1.value);
if (!f2.isDefaultValue) sum += Number(f2.value);
if (!f3.isDefaultValue) sum += Number(f3.value);

event.value = sum;

 

Important:

  • isDefaultValue helps identify whether a field value has changed since the form was opened.

  • You can adjust the logic based on how you distinguish between “existing” and “new” data.

 

Alternatively, you can add a check box, and based on that, you can decide whether to pay this fee or not. 

 

 


~Tariq

Translate
Participating Frequently
Jul 15, 2016 9:54 AM UTC

Ah, understood! Have located the 'calculate' option! Just a final q, is it possible to minus values? Could only see options for plus and multiply...

Translate
Bernd Alheit
Community Expert
Community Expert
Jul 15, 2016 10:03 AM UTC

For this use the simplified field notation.

Translate
Participating Frequently
Jul 15, 2016 12:07 PM UTC

Thanks Bernd, unfortunately I'm not familiar with creating/editing Java Script

Translate
Inspiring
Jul 14, 2016 5:59 PM UTC

Sure. You can use the built-in method for adding field values on the Calculate tab of the field properties dialog for the 6th field that you want to auto-calculate. You'll also notice the simplified field notation and custom JavaScript options, which you may want or need to use.

Here's a link to a good tutorial: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Translate
Participating Frequently
Jul 14, 2016 7:18 PM UTC

Thank you, I don't seem to have a calculate tab in field properties? Only General, Appearance, Position and Options. Can't find any options for calculating at all? I'm using the Creative Cloud Acrobat DC...

Translate
Inspiring
Jul 14, 2016 7:27 PM UTC

You must have selected the "This document requires signatures" check box when you started creating the form. What you can do is go into form editing mode, click the "More" button in the right-hand pane, and select "Revert to Acrobat Form". This will make it a regular Acroform that allows custom calculations. If you really need this to work with the Adobe Sign service, then you won't be able to use automatic calculations.

Translate