Calculations and Quote Forms
The Calculation field works out a number from other answers: an order total, a quote, a score or a price estimate. The result updates as the visitor types, and FormGlut checks it again on the server when the form is submitted, so visitors cannot change it.
Add a calculation
- Add the fields the calculation needs, for example a Numeric Field Quantity and a Dropdown Size.
- Add a Calculation field (under Advanced Fields).
- In Formula, write the calculation using field tags, for example:
{field:quantity} * {field:price}
Copy a field’s tag from the ID chip in its options.
What you can use in a formula
| Item | Example |
|---|---|
| Field values | {field:f1a2b3} |
| Numbers | 10, 2.5 |
| Operators | + - * / % |
| Brackets | ({field:a} + {field:b}) * 2 |
| Functions | round(x, 2), min(), max(), abs(), ceil(), floor() |
For Dropdown, Radio and Checkbox fields, each choice uses its calculation value. In the field’s choices list, turn on Calculation values and give every choice a number, for example Small = 10, Medium = 15, Large = 20. If a choice has no calculation value, its saved value is used when it is a number.
Display options
| Option | What it does |
|---|---|
| Text before the number | For example $. |
| Text after the number | For example USD. |
| Decimal places | How many decimals to show. |
| Thousands separator in emails and entries | None, comma, dot or space. |
| Hide on the form | Hides the result but still calculates and saves it. |
Example: a simple quote form
- Dropdown Service, with the choices Design, Development and Marketing. Turn on Calculation values and enter 500, 1200 and 800.
- Numeric Field Months.
- Calculation Estimated price, with formula
{field:service} * {field:months}and Text before the number set to$. Replaceserviceandmonthswith the tags you copied from those two fields.
Charge the total
To take a payment for the calculated amount, add a Card Payment field and set Amount to charge to Result of a Calculation field. See Stripe Payments.
