Individual Checkbox Comments
Any SurveyJS question can include a comment area that allows users to explain or elaborate on their answer. For select-based questions—such as Dropdown, Radio Button Group, and Checkboxes—you can also enable comment areas for individual choice options. This example demonstrates how to configure and use this feature.
Individual Choice Comments Configuration
To enable a comment area for a specific choice option, set its showCommentArea
property to true
. You can also set the isCommentRequired
property to make the comment mandatory when that option is selected.
To guide users on what to enter in the comment area, use the commentPlaceholder
property. You can set this property within a choice item configuration object to apply the placeholder only to that item or set it on the question level to apply the same placeholder to all comment areas.
Data Format
When individual choice comments are enabled, the question's value format changes as follows:
- For single-choice questions (e.g., Dropdown or Radio Button Group), the value changes from a primitive to an object.
- For multiple-choice questions (e.g., Checkboxes), the value changes from an array of values to an array of objects.
Each object contains the following properties:
value
A selected choice value. You can rename this property using the question'svaluePropertyName
setting.comment
A comment provided for that choice.
Example:
When individual choice comments are disabled:
{
"car": [
"Ford",
"Volkswagen"
]
}
When individual choice comments are enabled:
{
"car": [
{
"value": "Ford",
"comment": "Comment for Ford"
},
{
"value": "Volkswagen",
"comment": "Comment for Volkswagen"
}
]
}
"Other" Choice Item Configuration
The "Other" item lets users provide a custom answer not listed in the choices. To enable it, set the question's showOtherItem
property to true.
The "Other" comment area inherits the question-level commentPlaceholder
value, if set. You can override it using the otherPlaceholder
property.
Checkbox questions also support other special choice options, such as "None", "Select All", "Don't Know", and "Refuse to Answer". For more details, refer to the Documentation section in the Checkboxes Question demo: