-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Is there a way to keep "empty option" (the one that is used by selectize for placeholder attribute) in dropdown? #163
Comments
Having the same question... |
Same here. |
Same here. In my case i have a multi-select using the plugins: ['remove_button','drag_drop']. Removing an item up to the last one, works as expected either by click on the x or using backspace. However, when you get to the last item in the box, and click x, it doesn't actually remove it from the select list. However, click backspace and it does! However..... in both cases, it does not set any option value="" to the select, which is what we need to remove it from that field, and set it back to a null select. Can this be done via a callback? It seems that it should be built in functionality, but may be a bug? Any thoughts? |
Same thing here, seems weird not to be able to have a blank option at least. |
Yeah this sucks... Anyone found a solution for this? |
I'm also looking for an answer! |
For such a fundamental use case for select boxes, it's amazing this issue has been open and unanswered for this long. Thinking about dropping this plugin from my toolbox. |
The only way I found so far is to use multiple select, with |
Around line 1601 comment out the "if (value) {" so that a blank value will load:
Around line 2999 this will all you to click a blank value remove "if (!value.length) return;"
|
Also need to allow typing without pressing the backspace on a blank value:
|
Do I need to say that modifying 3rd party sources is a bad choice? |
+1, have the same issue. Will try prgwiz's solution. |
First, I totally understand it's our choice to use this lib/plugin. However, it's a significant UX oversight to disallow (intentionally or not) selection of an empty value. The issue for us is if you select a non-empty value, you can't then select the empty one. |
+1, this missing option makes it hard to use selectize.js in a production environment. |
I'm confused why this was closed? That referenced issue seems unrelated |
@bkosborne This issue is NOT closed. The above notification is a reference, telling us that this issue is referenced in another issue (which is closed). |
Oops! misread that part. Thanks |
in theory you could just have (option value="empty_option")-(/option) then handle it with PHP or whatever, but that's hacky =/ |
I stumbled upon this issue & created a plugin for it, Here is the gist, @brianreavis please let me know if this makes sense so that I can generate a pull request for this plugin |
@mudassir0909 , thank you. This works well so far after briefly testing. It even seems to work with optgroups and multiple select! +1 |
I've also created a clear_selection which extends the |
@mudassir0909 your solution works great, thanks! |
I really don't think this should be the default behaviour of the plugin. Firstly, no modern browsers appear to use this behaviour; the 'placeholder label option' is selectable in all browsers as far as I am aware. And second, even if they did use this option as the placeholder, it should only occur when the select meets a whole bunch of other requirements, including being required and not multiple, according to w3c. It's really a shame as I otherwise really like this plugin. Please fix it. |
So? Can You @brianreavis at least respond to us? |
This is the most commented issue in the repository, and it's not even labeled 👎 |
Guys... this is an independent library – I have and always will be maintaining it in my free time. Sorry for not responding on this, but, the entitlement in this thread is getting crazy. This is OS software, fork and PR (or offer good feedback like @prgwiz @mudassir0909) instead of complaining, please? |
* upstream/master: (69 commits) Released 0.11.0. Added "allowEmptyOption" option (selectize#163). Fixed broken bootstrap3 build. Fixing confusing description renamed the undefined plugins variable to selector_plugins Released 0.10.1. Bind createFilter callback to Selectize instance. Released 0.10.0. Calculate scrollbar width (fixes selectize#360). Fix for selectize#438 + tests. Added createFilter sample to contacts demo. Cherry picked commit 6e04d7b from selectize#370. Minor cleanup of selectize#405. Forgot self qualifier on Jquery cached data allocated by selectized is now cleaned up at destroy time Removing extra tabs selectized class should not have been added before the classes were checked and propegated to all of the controls created by selectize. It was previously added after this initialization and is now also added at the same time. Used method call to isFull to avoid duplicate code Consolidated the refreshState call to capture just becoming full during bulk (or any) addItem call Delaying updating attributes and caret during bulk insertion ... Conflicts: src/selectize.js
Hi Brian!
First off - thank you for this great plugin!
At the moment I'm trying to embed selectize to our project in place of most select boxes. I've faced some issues while trying this, most of them I've managed to fix using css, but the one I didn't resolve so far is mentioned in title of my issue.
Currently once user picks any option, the only way they can clear the input I'm aware of is by pressing backspace. It seems a bit devious (user-unfriendly) to me when it comes to a non-autocomplete type dropdown, and many might never think about this possibility to clear the field value. Therefore my question: is there an existing way to keep option with value="" in my selectize dropdown (not multiple) to provide an intuitively clear way to clear input value. I believe value="" is often used in filter forms as "Any of options below".
Thanks for your help in advance!
The text was updated successfully, but these errors were encountered: