PDF Form Calculations and Validation
Make a PDF form do the maths and check answers: totals and formulas, currency and date formats, ranges, email and pattern checks, written as simple rules.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Load the form
Open the fillable PDF.
- 2Copy field names
Read the Field names table.
- 3Write rules
One rule per line.
- 4Add rules
Press Add rules and check the report.
- 5Test
Open the result in Adobe Reader and type values.
- 6Share
Tell users which reader runs the totals.
Sobre aquesta eina
Order forms, expense claims, invoices, timesheets and grant budgets often need totals: quantity times price, the sum of several lines, VAT on a subtotal. Forms also benefit from checks, such as an email that looks like an email, a date in the right format or an age within a sensible range. Adobe readers support all of this through small scripts attached to fields, but adding them normally means Acrobat Pro and some JavaScript. This tool lets you write the rules in plain lines: "Total = Qty * Price", "Total: number 2 £", "Date: date dd/mm/yyyy", "Email: email". It turns each line into the standard Acrobat form functions, attaches them to the right fields, sets the calculation order and makes calculated fields read-only. The report lists the form's field names, so you can copy them exactly, and the rules that were added.
Rule types
- Calculation: Total = SUM(Line1, Line2, Line3), with SUM, AVG, PRODUCT, MIN or MAX. - Formula: Total = Qty * Price, or VAT = Subtotal * 0.2, using field names, numbers and + - * / with brackets. - Number format: Price: number 2 £ (decimals and currency symbol: £, $, €, ₹, ৳ or none). - Percentage: Rate: percent 1. - Date: Start: date dd/mm/yyyy (or mm/dd/yyyy, yyyy-mm-dd, d mmmm yyyy). - Range: Age: range 18 120, or Hours: range 0 -, where a dash means no limit. - Email: Email: email. - Pattern: Postcode: pattern ^[A-Z0-9 ]'{5,8}'$ followed by a bar and a message to show when it does not match. - Required: Name: required. Formulas only accept field names, numbers and arithmetic, so nothing else can be injected into the form.
Field names
Names must match exactly, including spaces and capitals. The Field names table in the report lists them; rename unclear ones first with the PDF Form Field Editor.
Where rules work
Adobe Acrobat and Reader, Foxit, PDF-XChange and Nitro run form scripts on Windows and Mac. Browser viewers, Apple Preview and many phone apps fill fields but ignore scripts, so totals are not updated there. Tell people which reader to use if the totals matter, and always check figures before relying on them.
Limits
The tool adds new rules; it does not show or edit scripts already in a form beyond replacing the same action. Very complex logic, such as conditional sections, still needs Acrobat. Calculations follow the order in which you add them, so add line totals before the grand total that uses them. Form scripts are not allowed in PDF/A archives. This is not tax or accounting advice.
Exemple resolt
A charity's expense form gets 10 rules: Line total = Miles * Rate for five lines, Total = SUM of the five line totals, money formats with £ and two decimals, a date format and an email check; in Adobe Reader the total updates as the miles are typed.
En resum
- Categoria: Edita i signa
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: Adobe Acrobat JavaScript API: AFSimple_Calculate, AFNumber_Format, AFDate_FormatEx
Preguntes freqüents
Do I need to know JavaScript?
No. Write simple lines; the tool writes the standard Acrobat functions.
Will totals work on a phone?
Usually not; most phone and browser viewers ignore form scripts.
Why are calculated fields read-only?
So nobody types over a total; turn this off in the field editor if needed.
Can I use VAT or tax rates?
Yes, with a formula such as VAT = Subtotal * 0.2.
What if a field name has spaces?
Write it exactly as listed in the report.
Is the form uploaded?
No. Rules are added in your browser.
