# Calculator

Description of Calculator add-on of WordPress Form Maker plugin.

Would you like to process mathematical operations within your form fields, sum up fields, divide, etc.? Do you want to allow your clients to calculate their booking costs based on dates or you want to include logical operations to change the value of the field? Do all these and more with the Calculator add-on of WordPress form builder plugin.

Attention:Calculator Add-On requiresForm Makerversion1.8.32/2.8.32and higher: if you are using an older version, please update your plugin.

### General Description

The Form Maker Calculator add-on allows creating forms with dynamically calculated fields. These can be date calculations, mathematical operations such as addition, subtraction, multiplication, division and etc., math functions, as well as logical operations. You can choose the fields you want to use as a calculated field, choose the operation type and include form fields as basis for calculations/operations. The value of the field will be calculated in real time (using Javascript), that is when filling out operands the value will be automatically filled in calculated field.

### Calculator Integration

To activate calculator feature go to **Form Maker > Forms,** choose your form and go to **Form Options > Calculator.** Enable the add-on.

After that you need to choose the **Calculated field.** This will be the field which will display the calculated amount. Only the following field types can be used as calculated fields- Simple text (Text), Hidden field (Text) and Amount(Payment). Note that it is suggested to make these fields readonly. Amount and Simple Text fields will have Readonly listed as a field attribute checkbox. If you tick the checkbox the users will not be able to change calculated value, otherwise the user will be able to do so.

When the calculated field is selected you should press Add button (+). A textarea will open up where you can fill in operation equation. You can choose the symbol accompanying the value, e.g. add currency sign or fill in textual option of the symbol, e.g. USD. This can be useful in cases you don’t want to include currency symbol coming with Payment field. You can disable automatic currency within Amount field type.

**Operands.** Here you will see all fields which can be inserted within operation text area.The following types of fields can be used: Simple text (text), Single and Multiple choice options, Select, Date and Time. Note that though you can calculate Amount for PayPal field, the operands of the calculation should be non-Payment fields.

**Operators.** There are two types of operations which can be processed:

**Mathematical operations.**The list includes addition, subtraction, multiplication, division, opening and closing brackets, decimal point and list of math functions:**ABS.**Returns the absolute value of the number passed as parameter. Format of usage: ABS(%field%), e.g. if you have field value of -30.3, ABS (-30.3) should be used for returning 30.3.**CEIL.**Returns the next higher number that is greater than or equal to the number passed as parameter. Format of usage: CEIL(%field%), e.g. if you have CEIL(30.7) you will get 31.**FLOOR.**Returns the next lower number that is less than or equal to the number passed as parameter․ Format of usage: FLOOR(%field%), e.g. if you have FLOOR(30.7) you will get 30.**ROUND.**Returns a number that follows rounding rules. If the value of the passed parameter is greater than or equal to x.5, the returned value is x+1; otherwise the returned value is x․ Format of usage: ROUND(%field%) or ROUND (%field%, [precision]). The default value for precision is 0, e.g. ROUND(50.123) or ROUND(50.123, 0) will be 50, ROUND(50.123, 2) will return 50.12.**LOG.**Returns the natural logarithm (base e) or logarithm with fixed base of the number passed as parameter․ Format of usage: LOG(%field%) or LOG (%field1%,%field2%)․ LOG(25) or LOG(9,3) will return 2.**POW.**Returns the value of the first parameter raised to the power of the second parameter․ Format of usage: POW(%field1%,%field2%), e.g. with 2 and 5, POW(5,2) will be equal to 25.**SQRT.**Returns the square root of the number passed as parameter․ Format of usage:SQRT(%field%), e.g. SQRT(4) will return 2.**MAX.**Returns the greater value of the listed parameters․ Format of usage: MAX(%field1%,%field2%, %field3%) , e.g. MAX(4,2,3) will return 4.**MIN.**Returns the lesser value of the listed parameters․Format of usage:MIN(%field1%,%field2%,%field3%), e.g. MAX(4,2,3) will return 2.

**Logical operations****IF.**Checks whether a condition is met, and returns one value if true, and another if false: (logical_test ? value_if_true : value_if_false), e.g. %field1% is 10, (%field%<25?5:3) will return 5.**OR.**Checks whether any of arguments are true. Returns false only if all arguments are false: (x or y), e.g. (%field1%>3 or %field2%<3 )**AND.**Checks whether all arguments are true, and return true if all values are true: (x and y), e.g. (%field1%>3 and %field2%<3)**NOT.**Changes false to true, or true to false: not(x), not(true) returns false.

v.1.12.17