Back to contents

JetEngine: How to Use Hidden and Calculated Field Types

This tutorial describes the process and interprets the details of using Hidden and Calculated field types of JetEngine Forms functionality to use them in your values calculations by means of formulas.

From this tutorial, you will get knowledge of how to work with Hidden and Calculated field types to create math formulas that your visitors could use for their Forms on the frontend.

Hidden and Calculated field types

Let’s clear up what Hidden field type means. In fact, the name speaks for itself. You may add the value to this field that won’t be visible on the frontend, but can be used for calculations.

Calculated fields help you to use formulas. Using it, you can make any calculations using math formulas based on macros and display the result on the frontend. The values for the formulas you can take either from meta fields created previously for your custom post or from the fields filled on the front end by users.

NOTE. If you take the value of the Hidden field for the formula, be aware that it is attached to some meta field. The formula will work correctly only on those pages or posts where that meta field is added.

Using Hidden and Calculated field types

Let’s consider an example of using these fields. We’ll create a short Form for a product purchase.

1 Step — Adding Hidden field

First of all, create fields to display the product’s Price:

Price field

and Quantity:

Quantity field

Now, it is time for the Hidden field. In this tutorial, we’ll create a field for Tax, which further will be added to the final price, so that on the frontend visitors won’t see Tax field separately, but its value will be considered in the formula calculating Total Price.

Create a new field and select Hidden from the dropdown list in the Type:

Field settings

and input Name value:

Tax field

Next, in the Field Value select Current Post Meta and input meta field name ID:

Tax field

This value stands for pulling data from your Custom Post Type meta field. Let’s see where it can be located:

Custom Post Type meta field

2 Step — Adding Calculated field

Now, let’s create a Calculated field and see how the Hidden field can be used there. We assume this field’s purpose is to calculate the total price of the product, including tax. Create a new field and select its type as Calculated and input a name for it.

Total price field

In the Calculation Formula field, you need to input a math formula, which will further calculate the product’s total price depending on the quantity a visitor selects. Plus, we need it to consider tax and summarize the final price accordingly.

Total price field

In this particular case for our tutorial, our Calculation Formula consists of Product Quantity multiplied by the Product Price plus Tax:


where %FIELD::Tax% is a Hidden field type.

NOTE. The formula will work correctly only if you use the fields with Number type for it.

Add Calculated Value Prefix, which will be displayed on the frontend, and click the “Apply Changes” button:

Calculation Formula settings

When your Form is ready, click the “Publish” button:

Publish button

Let’s see how it works on the frontend:

see how it works on the frontend

Price and Quantity fields are visible, and Tax field is not, however, in the Total calculation formula its value is considered.

If we describe it as a math formula:

20 (Price) * 1 (Quantity) + 5 (Tax (hidden field)) = 25

If a visitor changes Quantity, the formula still calculates the Total Price considering tax value:

see how it works on the frontend

That’s all! Now you know how to use Hidden and Calculated field types to create formulas based on the values from the form fields. Enjoy managing your forms and create them effortlessly!