Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Add support for adding user created items to select boxes

Open devkral opened this issue 4 years ago • 18 comments

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).

devkral avatar Apr 16 '20 03:04 devkral

There is one missing part: the uniqueText doesn't show up with select boxes, but the creation is correctly prevented

devkral avatar Apr 16 '20 13:04 devkral

unique message for multi-select boxes is now fixed

devkral avatar Apr 20 '20 19:04 devkral

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

juanmiguelbesada avatar Apr 21 '20 13:04 juanmiguelbesada

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" ...

devkral avatar Apr 21 '20 14:04 devkral

atm I have tested change and choice events on a single-select type

juanmiguelbesada avatar Apr 21 '20 14:04 juanmiguelbesada

How do I initialize this? It doesnt work when I pass "addItems:true" to the choices object.

filotronik avatar Nov 22 '20 14:11 filotronik

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.

helenatxu avatar Jul 15 '21 16:07 helenatxu

I hope this feature will be merged in a short time 🙏 It would be really helpful ❗

kevinleto-informaticon avatar Feb 17 '22 14:02 kevinleto-informaticon

+1 For merging this feature if we can help with anything let us know @mtriff

alejandrotrevi avatar Mar 25 '22 18:03 alejandrotrevi

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

marcusjfloyd avatar Aug 14 '22 19:08 marcusjfloyd

Why this thing isn't merged yet? 🤔

Sogl avatar Dec 27 '22 13:12 Sogl

any updates?? this feature is needed

duhamaher avatar Feb 23 '23 10:02 duhamaher

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 avatar Jul 25 '23 07:07 devkral

@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??

Ikpixel avatar Jan 29 '24 12:01 Ikpixel

@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?

cubode avatar Mar 04 '24 11:03 cubode

I have no permission to merge. What would you need to merge?

devkral avatar Mar 06 '24 14:03 devkral

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

devkral avatar Mar 06 '24 14:03 devkral

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?

cubode avatar Mar 07 '24 10:03 cubode