Chosen provides the possibility to deselect on single select fields
> http://harvesthq.github.io/chosen/#allow-deselect-on-single-selects
Could easily be made configurable through the interface.
Chosen provides the possibility to deselect on single select fields
> http://harvesthq.github.io/chosen/#allow-deselect-on-single-selects
Could easily be made configurable through the interface.
Comments
Comment #1
hydra commentedYeah true! This is a nice feature but I will postpone it till the new alpha-3 release has been released. There are already big plans for a 3.x branch in #2076707: Introduce plugin system for chosen module and I will add your request to the list at #2076813: Move library options (configuration) to library plugin so we won't forget it.
Thanks a lot for your input!
Comment #2
rp7 commentedAll right!
In the mean while, I already made a patch providing this functionality for the 2.x branch. Might still be useful.
Comment #3
hydra commentedNice! So everyone searching for this feature, can use it! I did a quick review on your code. Perhaps we will add later to 2.x, but not without #2064325: Revise configuration page, because when we once added a new option, the next will come and so on...
But very nice of you to share a patch, very appreciated!
Whitespace
The variable needs to be removed from the system when uninstalling the module, have a quick look at chosen.install how it works!
Comment #4
rp7 commentedThat's odd - can't see the whitespace. What tool/command are you using to track it down? (I'm not very up to date on Git/creating patches)
Missed the chosen.install part - my bad. New patch attached.
Comment #5
hydra commentedStill there ;)
You can configure your editor to show whitespaces or even terminate them (what would be the "less work" way).
However, I recommend you to install dreditor plugin to your browser, have a look at http://dreditor.org, this is a really great tool to review patches on drupal.org. Using the preview function, you can have a look with it on your patch, before posting it :)
Comment #6
marcvangendThis would be a great feature, I've been scratching my head for a while figuring out why I could not deselect...
This issue was postponed on the alpha-3 release, but since we're on alpha-4 now, I guess it's time to re-open.
That said, I would like to suggest a slightly different aproach. The allow_single_deselect option is closely related to the question if a select box is required or not. As the Chosen documentation says:
So, instead of making this a global option, I think it would be much nicer if we can apply the option automatically, depending on the #required property of the form element. After all, there is no point in clearing the value on a required field. Likewise, it doesn't make sense to disallow users to clear a non-required field.
Comment #7
elijah lynnYeah, this has been postponed too long, reopening.
Comment #8
scottAtRoot802 commentedHas there been any progress with this. I was able to apply the patch, but it would be nice if this was integrated into the next version.
Comment #9
nagy.balint commentedI guess comment #1 is not going to happen any time soon.
So first we need to reroll the patch, and then I suppose since its a trivial addition we can commit it.
Comment #10
aludescher commentedPatch re-rolled against 7.x-2.x branch.
Comment #11
aludescher commentedComment #15
aludescher commentedCode style update.
Comment #17
nagy.balint commentedThanks, Committed.
About #6, the issue is that simply setting a field not required will not trigger this functionality, cause the first option will be - None - instead of empty. So in order to make this work we also need a form alter in fact, or a custom select list constructed from code.
Comment #19
nithinkolekar commented+1 for #6
If any one is using chosen in views exposed filter over Autocomplete deluxe issue #1079826: Autocomplete Deluxe Widget as Views Filter? you might have known first element in the list is -Any- with a value All, which makes the views to load all results.
So with addition to empty string All text should be excluded.