void question(string|array questionID, array|string items, [string options])
Shows the question with the specified questionID in the questionnaire. The function question()
is mainly used with Filters and Conditional Questions.
'XY01
'. combine=…
.array(2,4,6,8)
) or separated with a comma as a string ('2,4,6,8
'). In order to describe items 1, 3, 5, 6, 7, 8, 9 and 10, number ranges can also be specified in the item list, e.g. '1,3,5-10
' or array(1,3,'5-10')
. question()
command. Put each option in quotation marks (single or double) and separate multiple options with commas (see example below). 'show-title=no
''show-explanation=no
''show-items=no
''spacing=<n>
''number=<n>
'number=<n>
or number=yes
.'anchor=<number>
''anchor=none
''random
''random=<n>
''gap=<specification>
''gap=20
').'gap=line
''filter=<specification>
''filter=country
' to show all database entries whose key begins with “country”). To allow the correct encoding of a response in the suggesting text input, at least a part of the prefix mus be set in the question itself as prefix. The parameter in question()
can then narrow down these options.'direction=<up|down>
'up
) or descending (down
) order.'composition=<default|extended|dense>
''align-labels=<center|inside|outside|eachline>
''shading=<auto|none|start-shaded|start-unshaded|all-shaded|all-unshaded>
''flip-inputs
'
Note: Calling up the function question()
is equivalent to the drag & drop of a question into the questionnaire. If you integrate the command question()
into a question (e.g. in a filter) make sure that the same question is not put on the page again via drag & drop. Otherwise, the question appears twice.
Note: SoSci Survey differentiates between upper and low case for the ID and all options.
Note: Both the ID as well as other options must be quoted as a string; as a rule in quotation marks (single or double). Please see examples.
Tip: You can only show items dynamically that the participant selected in another question. For more details please see Use Selected Items in Another Question.
Tip: You do not have to type the question()
command by hand. You can just drag & drop a question into a PHP code element. See Introduction to PHP Code: Comfortable Programming (Questions and Texts).
question('BS10'); // Daily television use question('BS01', '2,1,4,5'); // items 2, 1, 4 and 5 are called up question('NH02', 'random=3'); // 3 items selected at random question('AA01', 'show-title=no'); // hide question title // The following three lines each show items 1 to 4 and 6 in question BS07 question('BS07', array(1,2,3,4,6)); question('BS07', array('1-4',6)); question('BS07', '1-4,6'); question('SK01', 'spacing=4'); // Display a scale and directly beneath ... question('SK02', '1', 'show-title=no'); // ... the first item of a free text input "Other: ___"