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

value for Dropdown question with choicesByUrl isn't returned in survey.data #138

Closed
nelero opened this issue Nov 28, 2016 · 5 comments
Closed
Labels

Comments

@nelero
Copy link

nelero commented Nov 28, 2016

When you use dropdown question with choicesByUrl, survey.data doesn't contain the value selected.
(tested with knockout integration)

@andrewtelnov
Copy link
Member

@nelero Could you show your survey json?
It works fine in the example: http://surveyjs.org/examples/questiontype-dropdownrestfull.html

Thank you,
Andrew

@nelero
Copy link
Author

nelero commented Nov 30, 2016

Ok, you're right 👍 selected value is ok.
But when i want to select a value in this dropdown, via survey.data = {"Country":"FR"};
i always stay on choose.

Survey.Survey.cssType = "bootstrap";
var surveyJson = {
 pages: [
  {
   name: "about_you",
   questions: [
    {
     type: "dropdown",
     choicesByUrl: {
      url: "https://api.myjson.com/bins/1e5ch",
      path: "RestResponse;result",
      valueName: "alpha_2_code",
      titleName: "name"
     },
     isRequired: true,
     name: "Country",
     startWithNewLine: false,
     title: "Country",
     
    }
 ]
};
var survey = new Survey.Survey(surveyJson);
survey.data = {"Country":"FR"};
survey.showProgressBar = "top";
 
 survey.render("mySurveyJSName");

@andrewtelnov
Copy link
Member

@nelero Indeed the dropdown is empty and knockout set value to underfined, question get that notification and reset the value. After loading the data, the value is empty.
I have fixed the issue.
Thank you,
Andrew

andrewtelnov added a commit that referenced this issue Nov 30, 2016
@nelero
Copy link
Author

nelero commented Dec 1, 2016

@andrewtelnov : thanks for the fix. How can i get the latest survey.knockout.js to test it ?
thanks

@andrewtelnov
Copy link
Member

@nelero I have just published a new version, 0.10.2, you may use it.

Thank you,
Andrew

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

No branches or pull requests

2 participants