Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new options on the fly #520

Closed
wants to merge 4 commits into from
Closed

Adding new options on the fly #520

wants to merge 4 commits into from

Conversation

gootik
Copy link

@gootik gootik commented Mar 6, 2012

Added a new option "add_new_options". If it is set, when a result is not found chosen will treat the new entry as an option and adds it to the selected list. work both on multiple select and single select.

e.g.

$('#.chosen-select').chosen({add_new_options: true});

@ehtb
Copy link

ehtb commented Apr 3, 2012

Thanks, great feature, works perfectly on my end, so please merge.

@ghost
Copy link

ghost commented Apr 3, 2012

+1

@stof
Copy link
Collaborator

stof commented Apr 3, 2012

changes should be done in the CoffeeScript source, not in the compiled JS code (your changes would be lost ont eh next compilation otherwise). And according to the contributing rules, changes must be applied to both the jQuery and the Prototype implementations to be accepted.

@stof
Copy link
Collaborator

stof commented Apr 3, 2012

Btw, this implementation is bad as it does not notify when a new option is added, letting the user add the option he wants in a select without giving a chance to execute some logic to make the choice valid (for instance doing a query to the server to add the option as a valid choice).

See #5 for the feature request and #166, #316, #320 and #326 for alternate implementations (which are more complete and implemented in coffeescript)

@koenpunt
Copy link
Collaborator

koenpunt commented Apr 3, 2012

Like @stof says, pull request that have changes made directly in the JS will never get merged. And you have to make the changes for both the jQuery version as the the Prototype version. Like stated in the README:

Contributing to Chosen

Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code.

  1. Make all changes in Coffeescript files, not JavaScript files.
  2. For feature changes, update both jQuery and Prototype versions

@stof
Copy link
Collaborator

stof commented Apr 3, 2012

btw, I don't think it is worth it reimplementing your PR in CoffeeScript as the implementation in #166 is better IMO

@tute
Copy link

tute commented May 16, 2012

#166 didn't work for me, but this did. Why no Pull Request on this is merged onto master, @pfiller?
Thanks!

@koenpunt
Copy link
Collaborator

@tute Why did #166 not work for you?

@pfiller
Copy link
Contributor

pfiller commented May 26, 2012

Thanks @shezarkhani

As @stof mentions, #166 seems to be a more complete way of handling this feature request so closing in favor of that.

@pfiller pfiller closed this May 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants