Hidden
Hidden fields store values that are never shown to the respondent — used to pass context, prefill data, or store intermediate results.
A hidden field stores a value that is never displayed to the respondent. Unlike calculate (which computes a value), hidden is used to carry in an externally provided value — for example, a task ID, a household ID passed from another system, or an enumerator code injected when the form is launched.
Basic XLSForm Specification
| type | name | label |
|---|---|---|
| hidden | household_id |
Labels are not required for hidden fields since nothing is rendered on screen.
Uses
Hidden fields are commonly used for:
- Passing a pre-assigned ID from the survey management system (e.g., household ID, case number, task code)
- Storing the form version or deployment metadata
- Injecting enumerator-specific configuration at form launch
- Carrying data from a parent form into a child form in linked workflows
- Storing a value derived from URL parameters when the form is opened via a web link
Setting a default value
The most common pattern is to use hidden with a default expression so the value is set when the form opens:
| type | name | default |
|---|---|---|
| hidden | deployment_code | ‘ZONE_A_2024’ |
| hidden | form_version | ‘3.1’ |
Referencing a hidden field in calculations
Hidden values can be referenced like any other field using ${fieldname}:
| type | name | label | calculation |
|---|---|---|---|
| hidden | zone_code | ||
| calculate | label_prefix | concat(’[’, ${zone_code}, ‘] ‘) | |
| note | intro | ${label_prefix} Welcome to the household survey |
Using hidden with prefill / URL parameters
When launching a web form via URL, you can pass parameters that populate hidden fields. This allows you to pre-load a household ID or task code without the enumerator typing it:
https://your-server.com/form/FORMID?household_id=H00123&zone_code=NORTH
The field named household_id will be automatically populated with H00123.
Best Practices
- Use
hidden(notcalculate) when the value is injected externally and should not be recomputed. - Use
calculatewhen the value is derived from other fields in the form. - Always set a
defaultif the hidden field must have a value — a hidden field with no default will be empty. - Name hidden fields clearly to distinguish them (e.g., prefix with
_hidden_or use a consistent naming convention).
Limitations
- Hidden fields are included in the exported data like any other field.
- They cannot be shown conditionally — they are always present (but invisible).
- If you need a field that computes dynamically, use
calculateinstead.