A type: hidden
question creates a text input field that is not visible to respondents but generates HTML elements on the survey page.
It is commonly used to store calculated values derived from other questions or variables. Note, coded variables are the newer, preferred methods to calculate hidden values.
R1_AGEMATH. VAR | Pet adopted from current year - Row 1
translate: n
type: hidden
cvalue: ((localtime time)[5] + 1900)-$QSGETPETR1C2
Hidden vs. Invisible
A type: hidden
question has important differences from a question widget with an invisible: y
tag.
- Hidden: Generates HTML and forces the page to display, even if no visible content exists. This allows JavaScript manipulation, as demonstrated in the example below.
- Invisible: Does not generate HTML and will not display a page without other visible content.
Additional examples
Validating a tooltip
In the example below, a script updates the value of Q555 to '1' when the explain
tag from the set text
MYINFO1 is viewed. The validation ensures Q555 equals '1' before proceeding.
Comments
0 comments
Please sign in to leave a comment.