Caldera Forms calculation fields are mainly used for calculating and displaying total prices based on form input. Calculation fields have two modes: visual and manual. The visual editor is a simple way to add, subtract, multiply and divide the values of fields or variables.
The visual editor is easy to use and works for most of the time. Most of this documentation concerns manual formulas, since they are an advanced feature.
The Money Format option, when checked will round off the calculated value to only show two decimal places. In addition, the calculated value will always have two decimal places. If you are using a calculation field to provide the total amount to be charged by a Caldera Forms payment processor, then you should check the money format option.
When Money Format is checked you will see two additional settings:
Thousand Separator: Enter the character that will be shown every three places in the value.
Decimal Separator: Enter the character to divide the whole number and decimal places.
Using Manual Mode
In manual mode, you can create complex formulas. You can create your calculations using any math function listed below. Field or variable values can be used via magic tags. For example to add the value of a field with the slug “field_1” to the sine of the field with the slug %field_2% you would use, for your manual calculation you would use
%field_1% + sin( %field_2% ).
For security reasons, calculation fields are processed both in the browser and then again on the server during submission. The calculations are processed in the browser so their results can be updated live providing a great experience to your customers. The calculations are re-run during submission to prevent tampering.
For this reason, it is important that when using magic tags based on GET variables to not use them directly in the calculation. Instead, create a hidden field, set its value with the magic tag and then use that hidden field in the calculation.
Allowed Math Functions For Caldera Forms Calculation Fields
All of these functions are used in the browser as methods of the global Math object. Caldera Forms automatically adds
Math.. To use
Math.pow() you would use
Notes On Manual Calculations
%field_1% * pow(%field_2%, 2 ).
Also keep in mind that you should not end your formula with a semicolon. You also can not use any variables or call other types of functions.