survey-creator icon indicating copy to clipboard operation
survey-creator copied to clipboard

Visible if expressions are not updated when a question choice value changes

Open cs-salim opened this issue 1 year ago • 1 comments

Are you requesting a feature, reporting a bug or ask a question?

Bug report

What is the current behavior?

When changing a question choice value, "visible if" fields using that value are not updated to use the new one. This is not the case for the logic tab for example, which updates its expressions on choice updates.

What is the expected behavior?

"visible if" expressions should reflect choice value changes

How would you reproduce the current behavior (if this is a bug)?

Create a dropdown question:

{
    "type": "checkbox",
    "name": "question1",
    "title": "question1",
    "choices": [
        {
            "value": "Item 1",
            "text": "Item 1"
        },
        "Item 2",
        "Item 3"
    ]
}

In another question, build the following expression in the "visible if" field: {question1} allof ['Item 1']

Change the "Item 1" choice value to "Item 12"

The "visible if" field will still be {question1} allof ['Item 1'] instead of {question1} allof ['Item 12']

Specify your

  • browser: Chrome
  • editor version: 1.9.120

cs-salim avatar Jan 18 '24 21:01 cs-salim

Hello @cs-salim, I followed your instructions, however, a visibleIf condition was properly updated on my side. I used a https://surveyjs.io/create-free-survey demo. Please refer to my demo: https://github.com/surveyjs/survey-creator/assets/22372972/43e4ce0d-efad-456b-a90e-75b54a58e324

The resultant survey JSON is shown below.

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "checkbox",
     "name": "question1",
     "choices": [
      {
       "value": "item1",
       "text": "Item 1"
      },
      {
       "value": "item222222222",
       "text": "Item 2"
      },
      {
       "value": "item3",
       "text": "Item 3"
      }
     ]
    },
    {
     "type": "boolean",
     "name": "question2",
     "visibleIf": "{question1} allof ['item222222222']"
    }
   ]
  }
 ]
}

Let me know if you experience a different behavior.

Thanks

JaneSjs avatar Apr 01 '24 09:04 JaneSjs