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.
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.
Configure a hidden field block
The hidden field block is available as a question type by clicking the
Question type dropdown after you've added a new block. You can add it in any given position and in an unlimited amount inside your forms.
After that you can change the settings 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 information you want to get, for example a timestamp, browser information like the user language, a cookie, a page URL, or screen information like the screen orientation;
- Depending on the selected type of field, complementary features and settings can come up.
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.
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.
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.
Using a hidden field value for 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.
Also read our blog
We also wrote a blog post with some more background information, use cases and working examples of hidden fields.