The range
tag defines a range of accepted values for numeric input questions. If a respondent submits an answer outside of the range, they are prompted to provide another response.
1. How many days on average do you exercise per week?
type: integer
range: 0-7
2. How many days on average do you dine out?
type: number
datatype: whole
range: <=7
Details
- The
range
tag can be included with number and integer questions and tables, or text questions and tables that include numeric datatypes. - Ranges are frequently defined with both upper and lower limits (e.g.,
range: 0-10
). They can also be expressed with only a lower bound or upper bound using numeric operators (e.g.,range: >0
orrange: <=10
). - Ranges can also be defined based on responses to a prior question.
- The
range
tag uses it's upper limit to determine a "reasonable" width for its text field. Include thesize
tag to adjust the field's size if needed.
Tags
The following tags are commonly used with range
.
Tag | Description |
datatype |
Specifies which response type is accepted. Common options include: 'number', 'integer', 'whole', and 'decimals'. |
maxlength |
Specifies the max number of characters that can be entered, including decimal separators. Note this can affect the largest value accepted (e.g., |
range_message |
Alters the default error message that is displayed if a respondent provides an answer outside of the specified range. |
size |
Specifies the width (in ems) of the text field. |
Additional examples
Basing ranges off of previous responses
Responses to previous questions can be used as input for the range
tag. In this example, the respondent's input for Q3 ('$Q3') is piped into the range
tag, setting the maximum accepted value for Q4.
3. How many pairs of shoes have you bought this year?
type: integer
size: 3
datatype: whole
4. How many of those pairs were dress shoes?
type: integer
datatype: whole
range: <=$Q3
size: 3
Comments
0 comments
Please sign in to leave a comment.