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

Already on GitHub? Sign in to your account

"Other" option after an empty search #498

Closed
chigley opened this Issue Feb 16, 2012 · 4 comments

Comments

Projects
None yet
5 participants

chigley commented Feb 16, 2012

If a search returns no results, is there a way to make the dropdown default to an option labelled "Other" rather than the "No results match..." message?

This is for a country dropdown, but we don't want to list every single country. When the Other option is selected, an event will make a text field visible beneath the dropdown for the user to type their country (just to explain the context!)

Thanks

I'm currently looking through the issue backlog, but I'm interested in something like this. Basically we have a number of options users can select but they can add their own if it is not listed.

It is currently possible to do this in a hackish way:

  1. Add an "Other" option to the list
  2. Change the no results text to tell the user to pick "Other" if they want to enter a custom value
  3. Handle the change event to detect if Other is in the array of selected options and show/hide the textbox as appropriate.

Perhaps the simplest solution is to provide a few more callbacks, including one for what to do if no match is found.

Contributor

slothbear commented Oct 6, 2012

Check out #166.

Contributor

pfiller commented Apr 24, 2013

I don't think an "other" option is something we'll build into Chosen, but something like #166 is certainly intriguing. That pull request solves #5.

@pfiller pfiller closed this Apr 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment