Survey-library: defaultValue choicesByUrl not defaulting value

Created on 15 Mar 2018  路  6Comments  路  Source: surveyjs/survey-library

This is a bug report for a dropdown when a defaultValue is provided along with a choicesByUrl. On initial page load, the defaultValue is not selected from the list after the choices are loaded. Our example has a static list and a dynamic list for you to compare

https://plnkr.co/edit/DNJt35sNZ0rNbZ0YklyA?p=preview

  • browser: chrome
  • browser version: 65.0.3325.162
  • surveyjs platform (angular or react or jquery or knockout or vue): jquery
  • surveyjs version: 1.0.14

Thanks!

bug fixed

Most helpful comment

@erbaker @mdickin I have fixed the bug. Unfortunately I could not reproduce it in Unit Test. I have added in TODO to add a functional test (TestCafe test).
The bug was here all the time in knockout version. We built jQuery based on react version by using preact. Since couple months ago jQuery is built based on knockout version.

Here is what happend. knockout clears a question value on empty dropdown. We have written a workaround for this, but this workaround doesn't work correctly when the value is setting onLoading survey via defaultValue. I have updated our work-around.

The update will be available on the next week.

Thank you,
Andrew

All 6 comments

@erbaker I have added a unit test and could not reproduce the issue.
I have created an example and it works fine: https://plnkr.co/edit/37RmsmKLJjtuY0pvcp5a?p=preview
You do not use the https://restcountries.eu api correctly.

Thank you,
Andrew

The issue isn't the implementation of the REST API; I have updated your plunkr:
https://plnkr.co/edit/3PZPEQwIBWAqM6wDXNlK?p=preview

I would expect that "Chad" is selected in the countries box by default.

Here is the same plunkr from above but with version 0.12.36

https://plnkr.co/edit/qVPseqNDfCbwIO1ETiPh?p=preview

To narrow it down a bit more, it looks like this bug surfaced in the changes from v1.0.1 to v1.0.2.

@erbaker @mdickin I have fixed the bug. Unfortunately I could not reproduce it in Unit Test. I have added in TODO to add a functional test (TestCafe test).
The bug was here all the time in knockout version. We built jQuery based on react version by using preact. Since couple months ago jQuery is built based on knockout version.

Here is what happend. knockout clears a question value on empty dropdown. We have written a workaround for this, but this workaround doesn't work correctly when the value is setting onLoading survey via defaultValue. I have updated our work-around.

The update will be available on the next week.

Thank you,
Andrew

Thank you for the quick turnaround, @andrewtelnov!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nadialo picture nadialo  路  4Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

spertusatti picture spertusatti  路  3Comments

AWIXOR picture AWIXOR  路  3Comments