Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

Form Calculations

Form Calculations

RSForm!Pro allows you to perform simple calculations within your custom form. To better understand how this works, we will provide an example. If this is not enough, you can also check the Video Tutorial.

Note: The example form presented in this article can be simply added to your Joomla! installation through the "Create a new form wizard" by selecting the "Calculation Form".

Let's assume you want a mobile personalization form, which based on the user choices, will result in a final price.


What are we going to use for the calculation:

  • radio group field (used to select different mobile storages)
  • another radio group field (for the mobile color)
  • dropdown field (to select the quantity)

How to setup these above form fields:

First radio group

Besides the standard setup of a radio group, we will specify the following items:

  • 16GB|16GB - $399[p399][c]
  • 32GB|32GB - $499[p499]
  • 64GB|64GB - $599[p599]

Second radio group

The second radio group will have these items:

  • Black|Black[p0]
  • White|White +$39[c][p39]
Explanation:
  • The pipeline "|" symbol is used to split the value into "value | label". Only the right part after the pipeline will be shown in the frontend area, as the left part before the pipeline will be the actual value of the selection.
  • To specify a price for a selection you will have to use the [p] syntax with the numeric value inside the square brackets, as you can see above.
  • The [c] syntax is used to make that item pre-selected when the form shows in the frontend.
Note: If you are to use textbox or hidden field, you will only need to add the actual numeric value, without the [p] syntax.

The dropdown

Besides the standard setup of a dropdown, we will specify these items:

  • 1[p1]
  • 2[p2]
  • 3[p3]
  • 4[p4]
  • 5[p5]
  • 6[p6]
  • 7[p7]
  • 8[p8]
  • 9[p9]
  • 10[p10]

Adding the calculation equation:

Besides the form fields specified above, we will also need a textbox field in our form for the total. After we have added this field, we will head to Properties(backend > Components > RSForm!Pro > Manage Forms > your form > Properties) and select Calculations from the left panel.

The fields we have used in our form have their own specific placeholders, these placeholders can be used in our equation. You can view what placeholders you can use by simply clicking on the input field within this area.

Standard operators can be used and the variables can be grouped in brackets:

  • + addition
  • - subtraction
  • * multiply
  • / division

Example equation based on our scenario:

( {Storage:value} + {Color:value} ) * {Quantity:value}

Notice that the "storage" and the "color" are grouped together and then multiplied with the quantity.

The calculation is added by selecting the total field, adding the equation and clicking on the plus "+" icon(as seen in the right picture). Afterwards simply Save and test this in the frontend area.

Important: The calculation equations can only be used with input fields.


Calculations Configuration - optional



You can customize the calculation even further by specifying the thousand separator, decimal separator and the number of decimals. These are found in the backend > Components > RSForm!Pro > Configuration > Calculations, as seen in the left picture.

Feedback