Create a Yes/No Question
To create a Boolean question, define an object with the
type property set to
"boolean" and add it to the
elements array. Within this object, specify the question's
title and a unique
name that identifies the question.
Change Positive and Negative Text Labels
A Boolean question displays "Yes" for the positive answer and "No" for the negative answer. Use the
labelFalse properties to change the displayed text labels. In this demo, you can use Settings to change the labels at runtime.
Save Custom Values for
Survey results store
false as an answer to a Boolean question. If you want to save custom values instead, assign them to the
valueFalse properties. You will still be able to access the selected Boolean value via the
booleanValue property. In this demo, Boolean questions save "Yes" or "No" in survey results.
Change Display Mode
Boolean questions support two UI modes: slider and radio button group. The slider UI is used with short labels; the radio button group UI—with long labels. If you want to force a question to use the radio button group UI regardless of the label length, set the
renderAs property to
"radio". In this example, the second question demonstrates this case.