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

Could not modify dropdown value from survey correctly if choices are loading from web #6433

Closed
andrewtelnov opened this issue Jun 27, 2023 · 0 comments · Fixed by #6434
Closed
Assignees
Labels
Milestone

Comments

@andrewtelnov
Copy link
Member

If dropdown value has a value initially, for example defaultValue, and survey.data = newData; or survey.mergeData(newData); is called when choices are loading from a server async, then a new value from survey.data is not set correctly. Here is the example and code:

const json = {
  "elements": [{
    "type": "dropdown",
    "name": "country",
    "defaultValue": "France",
    "choicesByUrl": {
      "url": "https://surveyjs.io/api/CountriesExample",
      "valueName": "name"
    }
  }],
  "showQuestionNumbers": false
}
const survey = new Survey.Model(json);
survey.mergeData({country: "Italy"});

The expected value is Italy, but it will be the default value "France".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant