How do I add a hidden field to a form?

A hidden field can be used to collect information about contacts at the moment they submit your form. This field is not visible to contacts signing up. You can use the hidden field not only to collect information, for example via UTM parameters, but also to help identify spam sign-ups.

In this article, we'll show you how to add a hidden field to your form and cover the following topics:

Please note! Hidden fields can only be used with inline forms. They cannot be added to the following form types: floating box, floating bar, and modal form.

Adding a hidden field

  1. Go to 'Websites' in the left menu and select 'Forms'.

    formulieren.png
  2. Click on the specific form to which you want to add a hidden field.
  3. If you don't have any hidden fields yet, you can create them via 'Custom fields'. Click on the plus sign next to 'Custom fields' in the grey edit menu. 



  4. Then choose 'Hidden field' from the drop-down menu:



  5. Enter a name for your hidden field and click 'Add'. In this example, we have given the name 'Hidden field'.
  6. Drag the field from the menu into the form where you want it to be placed.

Using a hidden field to collect information about your contacts

You may be wondering how exactly that field collects information about your contacts. There are several ways to set this up.

Add a query string to your form's URL

This method will add a fixed value to your hidden field. 

Example: Suppose I have added a hidden field named 'Hidden field', then the personalisation tag for this field is %HIDDEN_FIELD%. I want that when someone submits the form, this contact receives the value 'Test' through the hidden field. To achieve this, the personalisation tag of this field needs to be adjusted. For this, I refer to the URL of the form. This can be seen via 'Integrate' when you have the relevant form in MailBlue:



The link in this case is: https://newdesignsandbox.activehosted.com/f/21 
You can adjust the URL to have the default value 'Test' filled in by adding a question mark, the field name (without percentage signs), followed by an equal sign and the value you want to fill in.

?hidden_field=Test

The form URL will then look like this: https://newdesignsandbox.activehosted.com/f/21?hidden_field=Test

The form in your account looks like this:

Hidden_field_form_visible_in_editor.png

Your hidden field, or the red highlighted section, is not visible to your contacts when they submit the form online. They will see the longer link that you adjusted in the form URL. Once a contact submits the form, the value in the 'Hidden Field' will be filled in with 'Test':

hidden_field.png

Tip: if you want to include UTM parameters in the hidden field, you can create a hidden field in the same way and adjust the corresponding personalisation tag by using an underscore, matching the URL parameter.

Add a fixed value to the full embed code

After adding a hidden field, you can integrate the full embed code of your form on your site. Here, you can enter a fixed value for the hidden field within the HTML code of the form.

Full_embed_code.png

Within the code, you have a section with "hidden" name="field. Behind this, you can enter the relevant value (between the quotes after 'value'):


embed.png

Add a dynamic value to the full embed code

You can also add custom code to your website to fill in dynamic information when the form is submitted. This requires knowledge of creating/writing custom codes. Unfortunately, we do not have this knowledge and cannot provide further assistance in this.

Use a hidden field to intercept spam sign-ups

If you want to use the hidden field to prevent spam sign-ups, simply adding this hidden field is all you need to do. Leave the value intentionally blank. For example, you could name the field 'Spam Contact' for your own recognition. If a value is added to this field after submitting the form, you will know that it is a spam bot that submitted the form and not an actual person. A 'normal' person/contact cannot see the field and therefore cannot fill it in.

This construction is not 100% spam proof, as clever bots also do not fill in the hidden field. The best way to protect your form from spam sign-ups is to use captcha and/or have double opt-in enabled. Both options are further explained in this article.

Was this article helpful?
0 out of 0 found this helpful