setvalue
populates a given survey field with a particular value. It is most commonly used for coding of skipped fields or populated derived fields and can be defined as a standalone widget or element decorator.
Syntax
# Setting a value setvalue question: Question ID value: Value or expression # Setting a single option value to checkbox, preserving any existing data setvalue question: Question ID option: Option ID or expression value: 1 or 0 # Setting multiple values to a checkbox, overwriting all existing data setvalue question: Question ID value: [Option 1, Option 2, etc.] # Setting a value inline as an element decorator 1. Some question type: radio 1. Set Q2 to 1 {set question: Q2 value: 1 } 2. Set Q2 to 2 {set question: Q2 value: 2 }
Caution! Using the value
tag without the option
tag on a checkbox question will overwrite any existing checked options.
Additional tags
Tags |
Description |
---|---|
|
Evaluates a Boolean expression which must be true for the setvalue to execute. |
onload |
Indicates that the set value should execute when the page is loaded rather than when the page is submitted. |
Examples
Skip and autocode
Note: As an alternative to the above example, it is possible to apply the autocode
tag directly to a follow up question when only a single option has been selected in a previous question.
Perl concatenate in sum-to-100 table
Combine split table data
Note: The two vertical pipes (||
) in the set value
widget's value
tag above indicate an "OR". There are instances where you may need to use two forward slashes (//); for example, when piping forward the response code "0".
Comments
0 comments
Please sign in to leave a comment.