Req: Including non-specified values #5

f055 opened this Issue Jul 19, 2011 · 62 comments

This plugin looks and works great as a replacement of the select field. I have a request though: if you add an option to accept values not present in the select, this plugin would be a great autosuggest tool as well (confirmation of new value via enter or user-defined delimiter - comma, space...). I'm really in need of such a thing, the single autosuggest that comes close to your doesn't have autoexpanding input field, so non-present values, when typed, get chopped off and look weird...


This is something I've been thinking about lately and may consider adding. In my mind, chosen would take an optional "allow_new" parameter and then there'd be an "add_new" callback or something.

Leaving this issue open.


I second this request.


This feature would be great. Particularly if it'll be able to suggest data from a remote json containing collections of { title : 'My choice', value : '1'}


+1 for this request. It would make the widget of first class use.

I developed one for this purpose alone yet never had the time to make it public. Yours looks way better and I'd be glad to start using it.



Various other 'auto complete' widgets don't offer this option either, or do so poorly.

This would make me use this widget every time if this feature existed.




+1 This would be grand indeed!


For very large datasets, being able to handle autocomplete through AJAX would be a boon.

For <select>s with not too many items, the DOM-based autocomplete/filter is sufficient, but when the items number in the thousands, not having to load the data as <option>s - instead utilizing AJAX autocomplete a la Drew Wilson's AutoSuggest would be tremendous.





this would be a very nice useful feature!




Perhaps my fork comes into place here? See:









yob commented Sep 7, 2011



Can we get some official words on this issue? Will be integrated or not?




This would be a great feature, indeed. +1.

@masonforest masonforest added a commit to masonforest/chosen that referenced this issue Oct 24, 2011
@masonforest masonforest Added "Add New" support as requested in issue #5 2317053

Add user confirmed entry to option list

I tried several branches providing a feature to add a user
confirmed suggestion. See issue harvesthq/chosen#392, issue

There a few differences:


  • no additional attributes
  • requires {create_option: true}
  • also has persistent_create_option, but not sure what it does
  • target to activate feature is large, full size link.


  • uses html5 data- attributes
  • requires no additional user js
  • hard target to acquire - the user needs to find a rather small add icon in order to trigger the feature.


  • uses user provided callback
  • The demo I checked out didn't actually add the new values to the selected values or to the list, it only alerted.

All three appear to do a nice job, but after reviewing all
three, if I were to pick one without somehow combining the
three, I would pick koenpunt's. If I missed someone's
branch, please let me know and I may review.

See #166 for original pull request, although ATM my pull request is up to date with chosen/master.


@bewest thanks for reviewing/comparing the three branches! I hadn't found @koenpunt 's branch, but having reviewed all three, I agree that this is the most complete. It may take some care to merge, given it diverged in August.


@edrex, It should merge clearnly; I brought it up to date myself and @koenpunt accepted my pull request.




+1 for koenpunt/chosen - please merge this.


I have two stupid question to ask as a newbie to GitHub ...

  1. Does the fact that there was a successful pull and merge mean that the root branch DOES have this functionality in it now?
  2. In bewest's review of the three forks he mentions that to enable you need to require {create_option: true} ... how does one do that? Is there an example someone can point me to?

First; my pull request isn't merged yet, so no, the root branch does not have this functionality.

Second; for examples see my pull request: #166



I tested your code with the latest version of my branch of 'chosen', and it works, so you probably just need to download the latest source:



I'm not going to continue on this issue in this thread, but I'm a 100% sure that you're not using the latest source. If you want any more explaination, you can send me a message. I would have sent you one but I can't ('ksnyde has not provided an email address').


Lephyrius, I worked with Koenpunt to solve this and it turned out not to be a code issue but rather a CSS issue. Make sure you use the latest CSS from Koenpunt's branch and see if this fixes you problem. It worked for me.


@pfiller you should probably take some time to review this feature as there is currently 5 open pull requests about it (among the 29 PRs) and many people are requesting it.




I've been using Select2 instead of Chosen. It allows you to add new items (like tags) on the fly and supports using an Ajax call or Javascript function as a datasource.


@balexand Kind of a rip-off don't you think?


@koenpunt not a rip-off but a documented fork incorporating new features.. I think that's fair game when ppl spend time proposing changes that are never merged..


Is there any activity on this rather old feature request, @pfiller? It would be nice to have this feature already :)


So it already in master branch or not?


Hi there, what's the progress on this after a year?


It's already done but in 3rd party fork.






Enticing comment from @pfiller over on #320 four days ago:

Going to close this PR in favor of #166






Please consider that the new option could be identical with the beginning of an existing option:

Existing Options:
  - Adam
  - Greg
  - Marcus

User types in "Marc", because he means "Marc" and not "Marcus"

This means the create_option should have 3 settings:

  1. Allow to create new value only when no results were found
  2. Allow to create new value at any time (or at least if x number of characters have been entered)
  3. Do not allow to create new values

@widescape Checkout my PR #166, which does exactly what you are describing (download here).


@koenpunt Great, looks good!



@koenpunt koenpunt locked and limited conversation to collaborators Jul 15, 2014

Locked this issue to prevent further +1 comments. @pfiller / @harvesthq knows it is a much requested feature, but outside of their vision of Chosen. My fork (#166) implements this feature, and there are ideas of making Chosen easier extendable (#1647), which could result in plugin enabled version of Chosen where you can decide for yourself if you want to add option adding functionality, ajax-loading of options and whatnot.

@pfiller pfiller removed the Has Solution label Jun 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.