|What's a query string?|
|Why is this useful?|
|Setting it up|
|Viewing the hidden value|
The Hidden value element allows you to collect a value in your responses that's taken from the query string in your survey or form's URL (thus the value isn't directly entered by the respondent).
This value is then only visible and accessible to you in the response, and not to the respondent.
A query string forms part of a URL after the question mark - for instance:https://www.mywebsite.com/?mykey=myvalue
It allows key-value pairs to be passed to a web application or database via a URL. You can have multiple keys and values in a query string, separated by '&' (e.g. mykey1=mykey1&mykey2=mykey2).
Here's an example use case:
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!
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.
Using the scenario above:
- Add the Hidden value element to your form. Remember - this will show in your reporting, so put it somewhere that makes sense (placing it as the last field in your form is a good option).
- Click on the element in the form and set up the query string key as 'staffmember' in the side panel
- Optional: If you also want the value stored against your contacts, assign it to a contact data field called 'STAFF_MEMBER'
- Save the form as usual
- Generate the form's share link (which, in this case, will be used for the different 'Contact me' buttons)
- Add a query string to end of the share link that corresponds with each staff member's 'Contact me' button. In Joe's case, his button's URL will be https://[formlink]?staffmember=Joe
Please note: Hidden values only work when a survey or form is shared as a link, not when embedded or as a pop-over.
Once your survey has at least one response, you can view the hidden value in reporting.
- Go to the reporting of your survey
- Click on the Responses tab, and open up a response. The hidden field will be shown, along with the value supplied.
The values can also be included on printed reports, and get included in exports.