-
Notifications
You must be signed in to change notification settings - Fork 9
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
default_value has no effect for DropdownQuestion #391
Comments
Thanks a lot for the report. I verified that this doesn't work at the moment. The python code correctly sets the property in the generated JSON, so it seems to be a problem on the SurveyJS side. I will look into it. |
Thank you for your response and verification. I am confident that I have identified the cause: the overriding of the data field when creating the Survey.Model object in the survey_js.jquery.jinja template. In your code, you use survey.data = data;, where data is likely an empty dictionary. This may be erasing default values for the questions. Judging from examples of survey form integration, overriding data is unnecessary. Simply passing a JSON dictionary to the model constructor, as shown in the SurveyJS documentation, should suffice. Please consider removing Thank you for your attention to this matter. |
Hello! I have encountered an issue with using the default_value parameter in the questions package. When using this parameter for
DropdownQuestion
type questions, it does not apply and the default selected value is not displayed.Here's a minimal code example that demonstrates this issue:
In this example, the default_value has no effect, and the default selected value "Stanley Castillo" is not set in the dropdown list.
I have also tested this issue with other question types that inherit from
ChoicesQuestion
, and they also do not apply the default_value.I expected that when using the default_value parameter in the
DropdownQuestion
definition, the default selected value would be displayed in the input field.Env:
questions package version: 0.8.0
Python version: 3.11
Operating system: Linux
The text was updated successfully, but these errors were encountered: