Hidden field

Hidden field are Feedback or Event fields whose values need to be included in the submitted survey, but where the value is obtained programmatically instead of asking the survey taker to provide the response. Survey takers never see the Hidden field. You can create multiple Hidden fields in a survey. Best practice is to group them near the beginning of the survey to make them easier to find and configure.

Hidden field includes the Field ID "Store (Receipt)"

Hidden field values are usually supplied either by URL parameters in Anonymous surveys or by a JavaScript validation in another content element in the survey. For example:

// To retrieve the value of a Hidden field
var hidden_field_value = fields.get('q_topic_id');
 
// To set the value of a Hidden field 
fields.set('q_topic_id', '0000');
Note: The field is maintained in the Survey engine and is never exposed in the survey HTML. As such, you never see hidden HTML:
<input type="hidden"> <!-- You will never see this the HTML for the survey -->

All fields declared in a Hidden field are always transferred to Experience Cloud when the survey is submitted. For fields referenced in all other elements in the survey, the Survey engine only transfers updated fields back to Experience Cloud when the survey takers completes the survey and whenever the survey taker navigates to a new page, such as when clicking Next or Back to ensure that partially completed surveys retain the supplied responses. However, when a field is updated by JavaScript validation, the Survey engine does not know that the value changed, and does not transfer it to Experience Cloud. For example, if JavaScript validation looks at the response of a Feedback field and, based on that response populates another Feedback field, the second one is not registered as being changed, and therefore does not get transferred to Experience Cloud.

Restriction: Do not configure Content logic: Hidden fields should always be visible in the survey. However, some previous versions may have JavaScript validation available.

For more information, see Survey content.