Yes/No Question

Sorry, we can't retrieve the data from server. Please comeback later.

A Yes/No, or Boolean, question asks respondents to select between two options: yes or no, true or false, etc. Boolean questions can be used to implement conditional survey logic or as standalone questions. This example demonstrates how to create and configure a Boolean question in SurveyJS Form Library. Switch between Angular, React, Knockout, jQuery, and Vue to view an example for your JavaScript framework.

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 labelTrue and 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 true and false

Survey results store true or false as an answer to a Boolean question. If you want to save custom values instead, assign them to the valueTrue and 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.


Positive answer:

Negative answer:

Why we use cookies.

This site uses cookies to make your browsing experience more convenient and personal. Cookies store useful information on your computer to help us improve the efficiency and relevance of our site for you. In some cases, they are essential to making the site work properly. By accessing this site, you consent to the use of cookies.

For more information, refer to DevSoft Baltic’ privacy policy and cookie policy.