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

Checkboxes: Selected choices are not reflected in another field that uses the defaultValueExpression property #6886

Closed
gitikakhanna opened this issue Sep 5, 2023 · 2 comments · Fixed by #6938
Assignees
Labels
bug user issue An issue or bug reported by users
Milestone

Comments

@gitikakhanna
Copy link

gitikakhanna commented Sep 5, 2023

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

Reporting a bug

What is the current behavior?

The selected choices (in checkboxes question) are not reflected in another field when trying to access the answer using Default Value Expression

What is the expected behavior?

Selected choices should be accessible and rendered in another field using Default Value Expression.

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

Step 1: Create a Checkbox question with multiple choices (question1)

Step 2: Create a Single-Input Field (question2) and the default value expression should be set as {question1}

Step 3: In the Preview tab, select multiple choices in Question 1. The value reflected in question 2 will be only the first choice that was selected in question 1. It does not reflect all the selected options separated by a comma.

Step 4: Unselect all choices in question1 and the question2 will still be reflecting the very first choice selected in question1.

In the below example, I selected multiple options in Question 1 (Favourite Sports) and the answer reflected in the text field didn't contain all the selected options. When I unselected all options, even then the value in second field did not change.

Checkbox.Bug.SurveyJS.mov

Provide the test code and the tested page URL (if applicable)

Tested page URL:
The bug is reproducible in the following codesandbox

Test code
https://codesandbox.io/s/checkbox-question-bug-28xq84?file=/src/json.js

Specify your

  • browser: Chrome
  • browser version: 112.0.5615.49
  • surveyjs platform (angular or react or jquery or knockout or vue): jquery
  • surveyjs version: 1.9.81
@JaneSjs JaneSjs self-assigned this Sep 5, 2023
@JaneSjs
Copy link
Contributor

JaneSjs commented Sep 11, 2023

Hello @gitikakhanna,
I appreciate your detailed explanation, and a demo. I reproduced the issue using the latest SurveyJS Form Library version. We'll research this issue and update you as soon as we get any news to share.

Thanks

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "checkbox",
     "name": "question1",
     "choices": [
      "Item 1",
      "Item 2",
      "Item 3"
     ]
    },
    {
     "type": "text",
     "name": "question2",
     "defaultValueExpression": "{question1}"
    }
   ]
  }
 ]
}

image

@JaneSjs JaneSjs added bug user issue An issue or bug reported by users labels Sep 11, 2023
@JaneSjs JaneSjs removed their assignment Sep 11, 2023
@andrewtelnov andrewtelnov self-assigned this Sep 11, 2023
@gitikakhanna
Copy link
Author

Hello @gitikakhanna, I appreciate your detailed explanation, and a demo. I reproduced the issue using the latest SurveyJS Form Library version. We'll research this issue and update you as soon as we get any news to share.

Thanks

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "checkbox",
     "name": "question1",
     "choices": [
      "Item 1",
      "Item 2",
      "Item 3"
     ]
    },
    {
     "type": "text",
     "name": "question2",
     "defaultValueExpression": "{question1}"
    }
   ]
  }
 ]
}

image

Thank you @JaneSjs

andrewtelnov added a commit that referenced this issue Sep 11, 2023
…eld using Default Value Expression Property fix #6886
tsv2013 pushed a commit that referenced this issue Sep 11, 2023
…eld using Default Value Expression Property fix #6886 (#6938)
@OlgaLarina OlgaLarina added this to the v1.9.108 milestone Sep 13, 2023
@RomanTsukanov RomanTsukanov changed the title Checkboxes Question: Choices selected are not reflected in another field using Default Value Expression Property Checkboxes: Selected choices selected are not reflected in another field that uses the defaultValueExpression property Sep 19, 2023
@RomanTsukanov RomanTsukanov changed the title Checkboxes: Selected choices selected are not reflected in another field that uses the defaultValueExpression property Checkboxes: Selected choices are not reflected in another field that uses the defaultValueExpression property Sep 20, 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.

4 participants