Hi surveyjs team,
I am trying to customise the dropdown to add an item to the list if item does not exist only on filtered choices, so the dropdown will only open when the user is typing a value that matches the choices.
I have appended on th list add new item and when the user clicks it the i am changing the hasOther from false to true.
now when i try to do the same when the .sv-list__empty-container appears, the link doesn't have the time to action because onblur acts faster.
is there anyway to prevent that?
here is a sample of the code
`survey.onAfterRenderQuestion.add(function (sender, options) {
options.question.onOpened.add(() => {
const newItemLinka = popupdrop.querySelector('.sv-list__empty-container');
newItemLinka.innerHTML = "<a href=#> add item</a>"
options.question.hasOther = true;
options.question.otherText = "Add a new company";
options.question.value = "other";
}
}
Thank you in advance
Vee
Hello Vee,
Thank you for reaching out to us.
From what I gather, you wish to allow respondents to append custom choices and add them to the drop-down list. Please refer to the following demo: View CodeSandbox. It shows how to use the React-Creatable component which allows users to create new choices. Please let me know if this is the desired functionality.
Hi Jane,
yes this is fantastic <3!
the only problem is that this is registered for all dropboxes and i am trying to use it to a specific one with a custom property:
addItem: true or something like that
is that possible?
Thank you
Vee ^__^