Req: Including non-specified values #5

Open
f055 opened this Issue Jul 19, 2011 · 62 comments
@f055

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

@pfiller

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.

@seanodotcom

I second this request.

@Amo

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'}

@florin

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

@Plasma

+1

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.

@yelvert

+1

@manuelmeurer

+1 This would be grand indeed!

@karoun

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.

@Neomeng

+1

@lostie

+1

this would be a very nice useful feature!

@tedkulp

+1

@koenpunt

Perhaps my fork comes into place here? See: https://github.com/koenpunt/chosen

@c-e

+1

@raykin

+1

@mlanza

+1

@ghost

+1

@yob
yob commented Sep 7, 2011

+1

@daFish

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

@twe4ked

+1

@sr8

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

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
harvesthq/chosen#5.

There a few differences:

koenpunt/chosen@08068f1

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

jimlindstrom/chosen@dd9c8c4

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

masonforest/chosen@b4a379a

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

@edrex

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

@bewest

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

@jbenet

+1

@nevf

+1 for koenpunt/chosen - please merge this.

@ksnyde

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

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

@ksnyde
@koenpunt

Ken,

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: https://raw.github.com/koenpunt/chosen/master/chosen/chosen.jquery.min.js

Cheers

@ksnyde
@koenpunt

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

@ksnyde

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.

@stof

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

@relrod

+1

@balexand

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.

@koenpunt

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

@toots

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

@laacz

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

@ComradeDOS

So it already in master branch or not?

@thejae

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

@ComradeDOS

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

@taunon

+1

@benel

+1

@whit537

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

Going to close this PR in favor of #166

🙀

@gitout

+1

@widescape

+1

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

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

@widescape

@koenpunt Great, looks good!

@AlJohri

+1

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

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.