Skip to content
PDFBetter Help center

Forms & fillable PDFs · Building fillable forms

Add calculated fields and conditional logic to a form

Add a Formula field and type an expression such as qty * price or sum(items_*_amount) under Calculation. To hide a field until it's relevant, open its Visibility section, turn on Show only when… and add rules.

Updated 2 min read

Calculated fields

  1. Step 1: Name the inputs

    Formulas refer to fields by their Database name (in Field options). Short names like qty, price and tax_rate are easier to type.

  2. Step 2: Add a Formula field

    In Create form mode, choose Formula from Add fields and place it where the result should appear. Formula fields are read-only.

  3. Step 3: Write the formula

    Under Calculation, type the expression. Suggestions offer field names and functions as you type, and the panel says Formula is valid. when it can be calculated.

  4. Step 4: Test it

    Choose Preview and fill the inputs. The result updates as you type.

You can useExample
+ - * / % ^ and brackets(hours * rate) - discount
sum, avg, min, max, countsum(line1_total, line2_total)
Wildcards in those functionssum(items_*_amount) adds every field named items_…_amount
round, abs, floor, ceilround(subtotal * 0.0825, 2)
if(condition, then, else) with == != < <= > >= && ||if(total > 1000, total * 0.1, 0)
concat to join textconcat(first_name, " ", last_name)

Empty fields are skipped by sum, avg, min, max and count. Amount fields round to their currency (two decimals, or whole yen), and you can set Decimals yourself.

Conditional logic: show a field only when…

  1. Step 1: Select the field to hide

    Click the field that should appear only sometimes, for example "Spouse's name".

  2. Step 2: Turn on Show only when…

    In Field options, open Visibility and turn on Show only when….

  3. Step 3: Add rules

    Choose a Field, a Condition and a Value, for example Marital status is Married. Choose Add rule for more, and set Match to all or any of the rules.

Conditions available: is, is not, contains, is greater than, is less than, is empty, is filled, is checked and is not checked. Text comparisons ignore upper and lower case.

  • Hidden fields never block submission, even if they're marked Required.
  • Formulas and visibility rules run in the PDFBetter editor, on published forms and on signing pages.
  • Other PDF readers (Acrobat, Preview) show every field and the last calculated value; they don't run PDFBetter's rules. Publish the form if the logic matters.
Can a formula use a dropdown or checkbox?

Yes. A dropdown's value is the chosen option, and you can compare it in if, for example if(plan == "Pro", 15, 0).

Why does my total show 0?

The input fields are empty, or the formula refers to names that don't match. Check the Database names in Field options.

Tools in this article

Did this answer your question?

Still stuck? Ask a person.

Tell us what you were trying to do and what happened instead. We reply within two business days, usually sooner.