Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultValueExpression doesn't work properly for text input questions when clearInvisibleValues is set to "onHiddenContainer" #7010

Closed
fabiocody opened this issue Sep 25, 2023 · 1 comment · Fixed by #7016
Assignees
Labels
bug user issue An issue or bug reported by users
Milestone

Comments

@fabiocody
Copy link

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

Reporting a bug.

What is the current behavior?

If clearInvisibleValues is set to onHiddenContainer, I don't get the result of defaultValueExpression in the text input when questions that appear in the expression change, as happens when clearInvisibleValues is set to onHidden or is not set.

What is the expected behavior?

defaultValueExpression should correctly set the value of the text input, even if clearInvisibleValues is set to onHiddenContainer.

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

{
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "radiogroup",
     "name": "question1",
     "choices": [
      "A",
      "B"
     ]
    },
    {
     "type": "panel",
     "name": "panel1",
     "elements": [
      {
       "type": "text",
       "name": "question2",
       "defaultValueExpression": "iif({question1} = 'A', 42, iif({question1} = 'B', 24, 0))"
      }
     ],
     "visibleIf": "{question1} anyof ['other', 'A', 'B']"
    }
   ]
  }
 ],
 "clearInvisibleValues": "onHiddenContainer"
}

This config can be used to reproduce the bug: if you select one of the first options and then change it, the value does not reflect the defaultValueExpression result.

Specify your

  • browser: Google Chrome
  • browser version: 116.0.5845.187
  • surveyjs platform (angular or react or jquery or knockout or vue): Angular
  • surveyjs version: 1.9.109
@andrewtelnov
Copy link
Member

@fabiocody The PR above fixes the issue.

Thank you,
Andrew

tsv2013 pushed a commit that referenced this issue Sep 26, 2023
@RomanTsukanov RomanTsukanov changed the title clearInvisibleValues onHiddenContainer breaks defaultValueExpression for text input defaultValueExpression doesn't work propertly for text input questions when clearInvisibleValues is set to "onHiddenContainer" Sep 26, 2023
@RomanTsukanov RomanTsukanov changed the title defaultValueExpression doesn't work propertly for text input questions when clearInvisibleValues is set to "onHiddenContainer" defaultValueExpression doesn't work properly for text input questions when clearInvisibleValues is set to "onHiddenContainer" Sep 26, 2023
@OlgaLarina OlgaLarina added this to the v1.9.110 milestone Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants