You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 survey.data = data; from the template. This will likely resolve the issue with displaying default values.
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: