Question Editor API Initialization
conditional_attributes
Property to define the conditional attributes of the custom Question / Feature. This can be used to conditionally display attributes based on the value of another attribute.
This is useful for creating dynamic forms where the options available to the user can change based on their previous selections.
The path passed to attribute_key
property (see below) is monitored by the Question Editor,
and if the value of it matches one of the value
strings in the provided conditions
property array objects, then the attributes
in that same object (as the matching value
) are rendered.
See related article more information, and examples.
Examples
"conditional_attributes": {
// property "multiple_responses" will be monitored
"attribute_key": "multiple_responses",
"conditions": [{
// value of property "multiple_attributes" which must match, in order to show the below attributes
"value": true,
// these properties will only be shown when "multiple_attributes" is true
"attributes": {
"min_selection": {
"description": "Defines how many options should be selected at least when giving an answer. 0 means an unlimited amount."
"min": 0,
"name": "Minimum number of responses",
"required": false,
"type": "number"
},
"max_selection": {
"description": "Defines how many options can be selected at most when giving an answer. 0 means an unlimited amount."
"min": 0,
"name": "Maximum number of responses",
"required": false,
"type": "number"
}
}
}]
}
Values
Attribute path custom_question_types.editor_schema.conditional_attributes
Type object
Properties
-
attribute_key string
The attribute key to be used for conditions.
-
conditions array[object]
Array of objects containing a conditional value, and attributes to be shown when the value is met.