Form: Collect hidden values from the query string of a page or form

Learn to use the hidden value block to get hidden values from the query string of a page or form. 

Overview 

The Hidden value element lets you collect a value in your responses that we take from the query string in your form's URL. This value is only visible and accessible to you in the response, and not to the respondent.

saf_hidden_value_element.png

Query strings explained

The query string forms the part of a URL after the question mark:

https://www.mywebsite.com/?mykey=myvalue

It allows key-value pairs to be passed to a web application or database using a URL. You can have multiple keys and values in a query string, each separated by &, for example, mykey1=mykey1&mykey2=mykey2.

Hidden values use case

This use case explains how a user might use hidden values to direct responses to individual staff members from a form.

Problem

You have a list of staff on your website, and each staff member has a Contact me button, linking to a form that collects a visitor's contact and enquiry details.

However, how will you know which staff member they wish to contact? You could create a form for each staff member - but that's a lot of unnecessary work!

Solution

Create just one form but make use of a query string key-value pair in each button's link to provide the staff member's name, e.g. https://[formlink]?staffmember=[their name]. This name gets stored in the response and you'll know who needs to pick up the enquiry.

diagram-hidden-value-600.png

Before you start

Things you need to know before you start:

  • To use hidden values, you must plan to share your form using the URL link only, and not embedded or as a pop-over.

Insert the Hidden value block

To add a hidden value block to your page or form:

  1. Go to Pages and forms and edit or create a form
  2. In EasyEditor, expand the Form blocks menu on the left side.
  3. Drag the Hidden value block onto the EasyEditor canvas.
    Remember, this shows only in your reporting, so put it somewhere that makes sense, for example, the last field in your form.
    saf_set_query_string_key.png
  4. Select the Hidden values block, and for Query string key, enter the query string key you want to use.
    hidden-values-block.png
  5. If you want the value stored against your contacts, assign it to a contact data field.
    In the use case above, we would assign it to the STAFF_MEMBER data field.
  6. Complete and select Save to save your form. 
  7. Publish your form, and copy the form's URL.
    To learn how to publish a form, check out the article Create and publish a form.
  8. Add your query string to end of the share link.
    In our use case example, this relates to each staff member's Contact me button. In Joe's case, his button's URL will be https://[formlink]?staffmember=Joe

View the hidden value

Once your survey has responses, you can see the hidden value in reporting.

To view the hidden value:

  1. Go to Pages and forms > Reporting.
  2. Find your form and in the Form responses column, select the number to see the responses.
    The hidden field is shown, along with the value supplied. The values are also included in printed reports, and exports.
    hidden_value_in_response.png

See also

Did you find this article helpful?

Can we help?

Thanks for using Dotdigital. If you need more help or support, then contact our support team.