mixed value(string variable, [string outputformat])
The participant's responses (answer codes, selected options or text inputs) can be determined with this function.
Note: Only responses given by the participant on an earlier page in the questionnaire, and already transmitted to the server with “Next” can be called up.
'XY01_02
'). 'code'
value()
: answer code according to the Variables Overview (also returned if no answer format is specified), for text input questions this is the text entered. 'code:ifany'
'code'
, but suppresses the warning (which isn't visible to respondents anyway) if the variable doesn't have an answer yet present.'label'
'text'
'free'
'csv'
Note: The value()
function can also read the draw of a random generator. This is already possible on the same page on which the random generator was placed, if the PHP-Code is placed below the random generator.
Note: The retention time (“TIME001”, “TIME002”, …) can't be read out using value()
. Please use the function caseTime() for this.
Tip: Please also see Filters and Conditional Questions and Show Answers in a Follow-up Question.
The respondent answered question 07
in section AB
(a dichotomous scale) on the previous page. The following code only calls up question XY01
if the participant answered “yes” (in this example with the value 2) to the item 03
in question AB07
:
if (value('AB07_03') == 2) { question('XY01'); }
The participant can select their favorite school subject or write it in themselves in “other:”. The subject should be displayed on a later page.
Tip: Please also see Placeholders.
$subject = value('AB08', 'free'); html('<h1>School subject: '.$subject.'</h1>');