PDF Guides

How to Add Totals and Checks to a PDF Form Without JavaScript

Make a fillable PDF add up line totals, format money and dates, and check emails and number ranges, by writing simple rules instead of form scripts.

Saizul Amin
Saizul Amin29 Oct 2026 · 3 min read
How to Add Totals and Checks to a PDF Form Without JavaScript

How to Add Totals and Checks to a PDF Form

An order form that adds up its own total, an expense claim that multiplies miles by the rate, an invoice that works out VAT: these save time and prevent arithmetic mistakes. PDF forms can do all of it, using small JavaScript functions that Adobe built into its readers. The catch is that setting them up normally needs Acrobat Pro and some knowledge of scripting. The free PDF Form Calculations and Validation tool lets you write the rules as plain lines instead.

Start with field names

Rules refer to fields by name, exactly as the form stores them. Load the form and look at the Field names table in the report. If the names are unclear, such as Text12, rename them first in the PDF Form Field Editor; "Qty 1" and "Price 1" make rules much easier to read and check.

Calculations

Write the field to fill, an equals sign and either a function or a formula:

  • Total = SUM(Line 1, Line 2, Line 3)
  • Average score = AVG(Score 1, Score 2, Score 3)
  • Line 1 = Qty 1 * Price 1
  • VAT = Subtotal * 0.2
  • Grand total = Subtotal + VAT

SUM, AVG, PRODUCT, MIN and MAX use Adobe's built-in calculation. Formulas may contain field names, numbers, + - * / and brackets, nothing else, so a rule cannot sneak other code into the form. Calculated fields are made read-only so nobody types over them, and the calculation order follows the order of your lines, so put line totals before the totals that use them.

Formats

  • Price 1: number 2 £ shows two decimals and a pound sign; use $, €, ₹, ৳ or none.
  • Rate: percent 1 shows 12.5%.
  • Start date: date dd/mm/yyyy, or mm/dd/yyyy, yyyy-mm-dd or d mmmm yyyy.

Formats also limit typing: a number field will not accept letters.

Checks

  • Age: range 18 120 rejects values outside the range; use a dash for no limit.
  • Email: email asks for a valid-looking address.
  • A pattern rule checks a field against a regular expression, with an optional message after a vertical bar, useful for postcodes or reference numbers.
  • Name: required marks the field as required.

Where it works, and where it does not

Adobe Acrobat and Reader, Foxit, PDF-XChange and Nitro run form scripts on Windows and Mac. Many other viewers do not: browser PDF viewers, Apple Preview, and most phone apps fill fields but ignore scripts, so totals stay empty or out of date there. If totals matter, tell people which reader to use, and always check important figures before relying on them.

Testing your form

Open the result in Adobe Reader, type values into the input fields and watch the totals change. Try wrong values in checked fields to see the messages. Fix any rule by editing the line and running the tool again on the original file.

A worked example

A mileage claim has five rows with Miles 1 to Miles 5 and Amount 1 to Amount 5, plus a Rate field and a Total. The rules are five lines such as Amount 1 = Miles 1 * Rate, then Total = SUM(Amount 1, Amount 2, Amount 3, Amount 4, Amount 5), then number formats with £ and two decimals for the amounts and the total, and a range check of 0 to 1000 on each mileage. In Adobe Reader, typing 42 miles at 0.45 shows £18.90 at once, and the total keeps up as the other rows are filled.

Good practice

Keep calculations simple and visible: label totals clearly, show the rate used for VAT or mileage on the form, and round money to two decimals with a number format. For archives in PDF/A, flatten the form, because scripts are not allowed in PDF/A files. The calculations are a convenience, not accounting or tax advice. Your form is processed in your browser and never uploaded.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages