Using logic5 Min.

How to use the hidden field block

Hidden fields are like hidden gems. Use them to make your forms and surveys more personal. Or keep track of your respondents or other information you pass to the form.


When to use

The idea of a hidden field block is you're able to store information without a visual representation in the form. That information is then saved with the rest of the form data when the form is submitted. But it can also be used to create logic in your form and make certain decisions based on the information in the hidden field.

How to use

The hidden field block is available as a question type. Add a new block to your form and then select the question type Hidden field. You can add it in any given position and in an unlimited amount inside your forms.

Hidden fields are available from the Question type menu.

Basic features

You can now change the features of the block to get the desired behavior:

  • Name

    The name of the field in your form (not visible for respondents).

  • Type of field

    This determines the type of information you want to get. Examples of field types are a querystring, a cookie, a page URL, a timestamp and browser information (like the user language).

Additional features

Depending on the selected type of field, additional features and settings can become activated to help you get the right value in your hidden field.


Logic

After you retrieved a hidden field in your form, you can instantly use that value to execute logic based on the value of the hidden field. For example, you can determine the flow in your form depending on the browser language of the respondent.

This works the same way you can add logic based on 'normal' question blocks, like you can see in this article on logic. It depends on the type of hidden field block which branch conditions are available.

Use a hidden field value to execute logic.

Logic (numeric hidden fields)

If your hidden field outputs a numeric value, it can work with the following branch conditions:

Block conditions

  • Value is equal to your filter;
  • Value is not equal to your filter;
  • Value is lower thanyour filter;
  • Value is higher than your filter;
  • Value is between your filters;
  • Value is not between your filters;
  • Value is specified;
  • Value is not specified.

Evaluate conditions

Similar to block conditions.

Filters

When we mention your filter(s) above, there are some different filters that you can use to make the right comparison:

  • Number - Compare with a fixed number that you enter;
  • Value - Compare with another block value entered in the form by a respondent (more info).

Logic (textual hidden fields)

If your hidden field outputs a textual value, it can work with the following branch conditions:

Block conditions

  • Value matches your filter;
  • Value does not match your filter;
  • Value contains your filter;
  • Value does not contain your filter;
  • Value starts with your filter;
  • Value ends with your filter;
  • Value is specified;
  • Value is not specified.

Evaluate conditions

Similar to block conditions.

Filters

When we mention your filter above, there are some different filters that you can use to make the right comparison:

  • Text - Compare with a fixed text that you enter;
  • Value - Compare with another block value entered in the form by a respondent (more info).

Examples

Let us show you some examples of how to use the hidden field.

Get page URL

Let's say you have embedded a Tripetto form on multiple pages inside your website and you want to know from which page someone has submitted a form. The hidden field can simply gather the page URL of the page that the form is embedded in and save that data to the entry data.

Example of a hidden field getting the page URL.

Get value from query string

The URL of a form/page can also contain certain values. Those are often stored in the query string of the URL. The query string is at the end of the URL and can contain fully flexible name-value pairs.

About querystrings

A querystring is a somewhat technical tool to send data in a URL. Some background information on how to supply a querystring:

  • You can add multiple parameters to a querystring;
  • Each parameter consists of a name and a value, separated by a = sign, for example name=value;
  • The first parameter is preceded by a ? sign;
  • Any following parameters are preceded by a & sign;

A full example could be something like this: https://yoursite.com/?name=abc&city=klm&country=xyz.

Let's say we have a form that we share via different channels, for example a mailing and Twitter. And you want to know how someone entered the form, so you can analyse which channel worked best. By adding a query string named referral to your URL's, you can add various values for that query string parameter that can be saved in a hidden field in the form.

So in the URL you share via a mailing the query string in the URL is something like ?referral=mailing. And for the URL you share on Twitter something like ?referral=twitter. Notice that all parameter names and values we use are just examples; those are totally flexible for your own needs.

Now, by adding a hidden field that reads the query string parameter referral, you can save where someone came from. Each entry will now contain where someone came from: the mailing, or Twitter.

Example of a hidden field getting the query string parameter referral.

Also read our blog

We also wrote a blog post with some more background information, use cases and working examples of hidden fields.


Discover our form blocks

How to use the...
In this article

    Help us improve