cguardia/questions

Add option is not already exists (DynamicDropdownQuestion?)

Closed this issue · 3 comments

Would it be possible to have a dropdown where the user can select existing values but also add an option if it doesn't exist already?
So like a dynamic dropdown question?

Hi. We depend on SurveyJs functionality, and this is not yet supported there, but seems to be planned for the future. See https://surveyjs.answerdesk.io/ticket/details/t5899/is-it-possible-to-have-the-dropdown-and-text-box-in-the-same-element

In that case, would it be possible to add an "other" option to the dropdown and have that dynamically create a textbox for the user to add their category?

It is possible. It would be something similar to this (untested) code:

    reason = DropdownQuestion(choices=["Too many emails", "Not interested", "other"])
    reason_other = TextQuestion(visible_if="{reason} == 'other'")