Hidden Fields and Calculations

Arclab® Web Form Builder

What are Hidden Fields?

 

 

Table of Contents:

Add a Hidden Field directly

Add a new element and go to "Hidden Fields":

 

Add a Hidden Field

Texts and Numerical Values

Go to "Hidden Fields" and add a "Generic Variable" to your form.
The position in the form does not matter.

 

Variable (Hidden Field)

 

Each hidden field has a unique field name through which the content can be accessed. Field names are displayed in curly brackets within the program, e.g. {Name}.

A "Variable (Hidden Field)" can contain text as well as a numeric value. When you create a new variable, the value is empty.
You can also preassign the variable with a numerical value or text in "Initial Content". You can simply enter text (without quotation marks) or a numeric value.

Hidden fields are displayed in "Design Mode" (see below), but they are not visible in "Preview Mode" and in the created form.

 

Edit Hidden Field

 

In the example above, a "Hidden Field" with the name "{MyField}" and the numerical value "0.19" was created.

Random Values

If you need a random value, you can also use the "Variable" or "Random Value" (Hidden Field) form element.

 

To do this, simply select the random value you want:

 

Random Value

 

In the example above, the "{MyRandomValue}" field is to be preset with a random integer between 5 and 25.

 

If you need a unique random ID, you can use the form element "UUID v4 (RFC 4211)".
This has the advantage that the probability of duplicate values is very unlikely and is therefore particularly suitable for order numbers or the like.

Combine Fields

With the form element "Special Elements" > "Hidden Fields" > "Combine Fields", a new hidden field is generated which contains a combination or sequence of fields and / or texts. This element is very versatile and can be used with texts as well as numeric values. In this case, however, there is no addition but a sequence of values.

 

Sample:

In the following example, a new hidden field with the name "{Name}" is to be created from the two input fields "{First_Name}" and "{Last_Name}".

 

Combine Fields

 

If the user enters e.g. "John" as first name and "Doe" as last name the result {Name} would be "Doe, John".

Date and Time

The form element "Special Elements"> "Hidden Fields"> "Date and Time" is very versatile and can be assigned a fixed date as well as used to calculate the date. You can choose the date or time format, depending on whether you need the date, time or both:

 

Date Time Format

 

 

Sample: Current Date

In the following example a new field with the name "{MyCurrentDateField}" is to be created, which contains the current date (and time).

 

Current Date

 

 

Sample: Calculate Date and Time

In the following example, a new field with the name "{Departure}" is to be created, which should be the date 7 days after the arrival selected by the user in a date picker (calendar).

 

Calculate Date

 

The input field {Arrival} is used here as the basis for calculating the hidden field {Departure}.
Of course, you can also use another hidden field of the "Date and Time" type as the basis for the calculation.

Calculations

Various elements for calculation are available in the program. You can find these under "Calculations":

 

Calculations

 

  • "Mathematical Expression" is used to calculate numerical values. Both hidden fields and input fields can be used in the formula.
    The result of the calculation is a numerical value which is saved in a new hidden field.

  • "Calculate Date and Time" is used to add or subtract a timespan from a base date.
    The result is a date which is saved in a new hidden field.

  • "Timespan" is used to calculate a timespan, i.e. the period between two date fields.
    The result is a numerical value which is saved in a new hidden field.

  • "Age Calculation" is used to calculate the age at the current time.
    The result is a numerical value which is saved in a new hidden field.

  • "Combine Fields" is used to create a new string with the contents of other fields and text.

 

The calculations are automatically updated as soon as a value (field) is changed in the form.

Mathematical Expression

"Mathematical Expression" is used to calculate numerical values. Both hidden fields and input fields can be used in the formula.
The result of the calculation is a numerical value which is saved in a new hidden field.

 

Mathematical Expression

 

Here you can enter any formula, either via the left block or directly.
To insert field contents, click "Insert Field" or just type the field name in curly brackets, e.g. {Fieldname}.

 

 

Sample: Mathematical Expression

In the following example, the total price {Total} is to be calculated from the quantity {Q} times the price {PPU}.

 

  • The quantity should be entered by the user in "My Order:". The edit box has the field name {Q}.
  • The unit price is specified in the hidden field {PPU} and should also be displayed in the form.
    In this example, the field contents are output via the form element: "Output Elements" > "Text".
  • The result of the calculation is stored in a new hidden numeric field named {Total}.

 

Sample: Mathematical Expression

 

The position of the hidden fields in the form is irrelevant. As you can see in the screenshot above, the field contents are output above the calculation.
The position of calculations in the form is only important if several consecutive calculations are performed.

"Number of Decimal Places" and "Decimal Seperator" refer to the result output.
If your formula contains a number with decimal places, always use a point as the decimal separator and not a comma!

Timespan

"Timespan" is used to calculate a timespan, i.e. the period between two date fields.
The result is a numerical value which is saved in a new hidden field.

 

The start and end times are always required to calculate a time span. These must be Date/Time fields.
You can do this with visible input elements such as the calendar element or hidden date/time fields.

 

Timespan

 

Important: Days and Calendar Days
You can choose between days and calendar days. When changing from winter to summer time (DST), the day of the change has only 23 hours, which corresponds to 0 days (1 day equals 24 hours) but 1 calendar day. It is important to understand the difference between days and calendar days. The time is irrelevant when calculating calendar days.