Skip to content

Expressions: {checkbox} notcontains 0 returns false even if the value is empty #10869

@JaneSjs

Description

@JaneSjs

T26284 - Checkbox choices enable if logic
https://surveyjs.answerdesk.io/internal/ticket/details/T26284


Survey JSON definition:

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "expression",
          "name": "question2",
          "title": "{question1} notcontains 0",
          "expression": "{question1} notcontains 0"
        },
        {
          "type": "expression",
          "name": "question3",
          "startWithNewLine": false,
          "title": "{question1} notcontains 0",
          "expression": "{question1} notcontains '0'"
        },
        {
          "type": "checkbox",
          "name": "question1",
          "choices": [
            {
              "value": "0",
              "text": ""
            },
            {
              "value": "1",
              "text": ""
            },
            {
              "value": "2",
              "text": ""
            }
          ]
        }
      ]
    }
  ],
  "headerView": "advanced"
}

Current behavior: when question1 is empty, {question1} notcontains 0 returns false and {question1} notcontains '0' returns true.
Expected behavior: when question1 is empty, {question1} notcontains 0 returns true.

Metadata

Metadata

Assignees

Labels

buguser issueAn issue or bug reported by users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions