Question T8547
Visible to All Users

Disable choice in checkbox

created 3 years ago

how can we disable choice in checkbox.
i have tried with enableIf but it is not working.
any help will be appropriated.

eg.

{
"type":"checkbox",
"name":"kids",
"title":"how many kids do you have?",
"choices":[
{ "value" : "1", "text" : "1","enableIf":true},
{ "value" : "2", "text" : "2","enableIf":false}
]
}

Answers approved by surveyjs Support

created 3 years ago

Hello,
You can use the expression only and true and false are boolean values, not an expression, string. However "false" is the expression. It will returns false value on running this expression.
Here is the correct example:

JavaScript
{ "type":"checkbox", "name":"kids", "title":"how many kids do you have?", "choices":[ "1", { "value" : "2", "text" : "2","enableIf":"false"} ] }

Thank you,
Andrew
SurveyJS Team

    Comments (2)

      it is working with normal choice box but not working inside matrix drop-down

      link:
      https://plnkr.co/edit/FUObM5efUm89maKC?preview

      select ford from drop-down to get matrix drop-down

        Hello,
        You are using a very old version of SurveyJS. Here is the example with the latest released version v1.9.5. It works correctly.

        Thank you,
        Andrew
        SurveyJS Team