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

"Other" option after an empty search #498

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

"Other" option after an empty search #498

chigley opened this issue Feb 16, 2012 · 4 comments

Comments

@chigley
Copy link

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

@jamescarr
Copy link

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.

@greglockwood
Copy link

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.

@slothbear
Copy link
Contributor

Check out #166.

@pfiller
Copy link
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 as completed Apr 24, 2013
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

No branches or pull requests

5 participants