Choices: User add item & multi-select

Created on 12 Sep 2016  路  30Comments  路  Source: Choices-js/Choices

Is it possible to mix multi-select with the users ability to add custom items? Or alternatively, give the text field some predefined suggestions in the style of the multi-select?

I've tried setting the choices option when targeting a text field, but it doesn't seem to work.

accepting PRs complex feature request

Most helpful comment

Just to give an update, I've begun work on this within a feature branch

All 30 comments

The ability to add custom items to a multi-select is a definite possibility - that would be fairly simple to implement. Thanks for the suggestion.

@jshjohnson if you are about to implement this feature can I also ask to apply this also for single select option tag? It would be great help on something I'm currently working...

@jshjohnson I would like to give you some input here, so for the single value:

http://codepen.io/dgt41/pen/xRbpwK/

And for the multiple values:

http://codepen.io/dgt41/pen/RoNxro

And couple remarks here:

  • there should be an option for the value (both for single and multiple)
  • the search should return ONLY exact results not partials as it is ATM

Hope this is somehow helpful

@jshjohnson any ETA here?

@dgt41

I'll be looking at this as soon as I can - very busy this week though. I'm happy to review pull requests.

Just to give an update, I've begun work on this within a feature branch

@jshjohnson I did some testing on the feature branch, so for the single the item is added but is not active:
screen shot 2016-11-14 at 22 48 32

For the multiple I do get some strange behaviour, adding a new item will also add another (already existing) item. I hope I can find some time debugging and contributing some code

FYI, I've a pushed a PR (https://github.com/jshjohnson/Choices/pull/79) to help complete this feature.
Feel free to comment !

Thanks to the PR from @StephaneTrebel, we're close to getting this feature through the door.

Things left to do:

  • [x] Ensure the select box stays focussed after inputting a custom choice
  • [x] Ensure the duplicateItems config option works with select elements (i.e. no inputting a value that already exists)
  • [ ] Ensure added values are shown in the dropdown if the dropdown contains groups

FYI, I've done some tests and I think that :

  • [ ] Ensure the duplicateItems config option works with select elements (i.e. no inputting a value that already exists)

is ok.

I have not tested the groups since I don't use them yet. If I do I'll give a heads up :)

Sorry, I do not understand how I do it.
Is it working or not?
Or is it still in development?

@erikskar This feature is still in development (in the feature/select-add-items branch)

Can we help?

Hi @rstacruz - sure! I think this feature is really close to completion. It just needs some unit tests + some investigation into option groups (i.e what should happen if you have a groups of options and you add a new option).

@jshjohnson any progress here?
Can you release a beta (that doesn't include the groups part)?

Thanks

News...

There is still one issue here if you have a select box with groups - added items do not appear in the dropdown. I think in this situation a group should be added titled 'Miscellaneous' with custom items within it. I don't think this is a blocker though so i've merged this into version 2.8.0.

Sorry guys, I can not find any code for this feature. 馃槪
Could anyone tell me how to set the configs to support add items for multi-select?

@zhanglun This feature is no longer being actively worked on. To enable it requires a more fundamental refactor of Choices (which is in the pipeline)

@jshjohnson
Thank you very much. I really look forward to the new version

I am curious if this issue will ever be resolved. It is 2019, and the issue was raised in 2016. If there is a new version of Choices coming out, when will it release?

Also, I would suggest that until then this be listed as a limitation of the tool on the main page. I have wasted a significant amount of time integrating Choices.js into our UI, before discovering that there is no way to provide a list of tags (with -select- tag) and additionally also allow the user to add their own tags. Maybe other individuals can be saved from this frustration...

Wow. I thought that the Choices have this feature. I need it too.

I have wasted a significant amount of time integrating Choices.js into our UI, before discovering that there is no way to provide a list of tags (with ) and additionally also allow the user to add their own tags.

The same situation..

I think I want to give a shot at making this work. I also want to use it for a project.

For anyone looking for a good alternative that supports this feature see https://github.com/yairEO/tagify

For anyone looking for a good alternative that supports this feature see https://github.com/yairEO/tagify

Works neat!

Easy temporary workaround for anyone in need

It's not perfect and I don't actually recommend it but if you're in need/in a hurry - it's something.

I have wasted a significant amount of time integrating Choices.js into our UI, before discovering that there is no way to provide a list of tags (with ) and additionally also allow the user to add their own tags.

^^ Ditto, quite surprising.

I have wasted a significant amount of time integrating Choices.js into our UI, before discovering that there is no way to provide a list of tags (with ) and additionally also allow the user to add their own tags.

^^ Ditto, quite surprising.

I had found myself in the same situation. Check out the fix I made. It's been working fine in production since July.

I would love to see this as an option.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tekord picture tekord  路  4Comments

michaelongithub picture michaelongithub  路  4Comments

zslabs picture zslabs  路  6Comments

kjugi picture kjugi  路  3Comments

ggcaponetto picture ggcaponetto  路  4Comments