Choices
Choices copied to clipboard
Add support for adding user created items to select boxes
Fixes #39 This PR adds support for adding user created items to select boxes. It reuses the addItems Flag for streamlining its behaviour for all supported elements (text, select, multi-select).
I would consider it as a breaking change for select boxes (fixable with addItems: false).
There is one missing part: the uniqueText doesn't show up with select boxes, but the creation is correctly prevented
unique message for multi-select boxes is now fixed
Choice and Change events do not fire when new item is created and selected. Also, if using placeholder and single-select some times when the new item is selected, placeholder is shown
Can you tell me, which events are affected? This would help me, fixing the error.
Anyway: if somebody needs this feature urgent, he can add in package.json: ... "choices.js": "devkral/Choices#feature/add_select_options" ...
atm I have tested change and choice events on a single-select type
How do I initialize this? It doesnt work when I pass "addItems:true" to the choices object.
Can you tell me, which events are affected? This would help me, fixing the error. Anyway: if somebody needs this feature urgent, he can add in package.json: ... "choices.js": "devkral/Choices#feature/add_select_options" ...
Hello @devkral , I'm trying your solution. How can I deactivate the addItemText
option? I have more than one select on my page and it's always activated no matter what. Even I don't specify that option.
I hope this feature will be merged in a short time 🙏 It would be really helpful ❗
+1 For merging this feature if we can help with anything let us know @mtriff
I ended up using @devkral's fork. I wish it would disable addItems by default for selects.
Still, going back and setting addItems to false in my project is a small price to pay compared to switching out for a whole new library.
Thanks for the good work @devkral +1
Why this thing isn't merged yet? 🤔
any updates?? this feature is needed
I switched to react mui and were busy, so there were no updates. I think I try to rebase but I am out of the code for years.
@devkral I am new to this but I used your pull request file via the zip and it works fine. But I found some issues.
-
When I start typing I can add the typed text by enter but when I type and see the option that I want I don't have the accessibility to use the keyboard keys to select the option, I need to remove everything I time and then I can navigate to the option by keyboard.
-
When I am on my IOS device and focused on the input search field I get the keyboard with a search key right at the bottom. Would be better to get the keyboard with the Return key right at the bottom. Maybe change the input tag to a textarea??
@devkral this feature would be essential for the library to remain competitive with other options like tagify, do you think you would be able to merge it?
I have no permission to merge. What would you need to merge?
Anyway the PR is so old, that the project for which I required the PR is dead. Therefor I didn't developed the patch further but if you can tell me what you need I will try to find some time
Thank you very much @devkral it would be basically to have the possibility to add new choices dynamically throuhg the text box. I am not sure why that feature is still not implemented in choices-js, who is the main maintainer?