Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It'd be awesome to choose to show the exposed filter widgets to users as a series of radios or checkboxes, rather than selects. Selects can be less intuitive and less accessible (see http://www.cs.tut.fi/~jkorpela/forms/choices.html#select-inflex for a big screed about why).
Sorry in advance if this is a feature or has been covered in some other issue; I could not find it.
Comments
Comment #1
momper CreditAttribution: momper commentedhello
i agree - perfect would be the possibility to choose for each filter if its checkbox or dropdown ...
1000x thanks and greetings momper
Comment #2
Firewolf CreditAttribution: Firewolf commentedEspecially for the cck fields single on/off checkboxes.
When I add such a field as exposed filter I get a textfield in which the user has to enter 0/1. A checkbox in that spot would be great.
Comment #3
Firewolf CreditAttribution: Firewolf commentedBased on code snippets on http://drupal.org/node/84286 I created the following code which works for me.
With this code in a separate test.module the single on/off checkbox field is shown as a checkbox for the exposed filter... and working ;)
The code is perhaps not stable and usefull for everybody, but can perhaps be improved by others or integrated in other modules.
Comment #4
zmove CreditAttribution: zmove commentedI don't understand how to put this code.
I create a "test" folder on my module folder like that : /sites/all/modules/test
I put the php code on a test.module file in this folder.
And the module don't appear on the drupal module listing...
How to activate this code ?
Comment #5
zmove CreditAttribution: zmove commentedSorry I didn't understand that the code only was for checkbox CCK.
As frank van geirt said, it could be really great and really usefull if cou can choose how you want to show your exposed filter in the exposed filter himself options. Like that you can select for each filter how you want to show it. You could have 1 exposer filter in radio button, another filter in checkbox etc...
The only way I found to have checkbox instead list is here http://drupal.org/node/138374
If I could I would work on it, but I'm not a great developper to try something like that (or maybe to take 2 years to develop it) but I think it could be the most usefull thing you could add to view today.
Comment #6
Coyote CreditAttribution: Coyote commentedIt would indeed be fantastically useful if, on a per-filter checkbox, you could decide whether to render the exposed filter as radios/checkboxes (depending on whether the "force single" box is checked, perhaps?)
Comment #7
nschelly CreditAttribution: nschelly commentedSubscribing... I'm looking for this functionality as well. I've tried stumbling around the views code to get a patch together, but I'm coming up short. I'll keep trying in the meantime, but if anyone has a good start, I'm looking.
Comment #8
nschelly CreditAttribution: nschelly commentedFor those interested, I did accomplish this in part with a small module that I posted here: http://drupal.org/project/views_checkboxes
I still think it's best served by making it a per-filter option in a view, but short of that, this module satisfies my generic needs and could probably be easily expanded for more usage.
-N
EDIT: Fixed the link... sorry.
Comment #9
Robin Millette CreditAttribution: Robin Millette commentedDo you mean http://drupal.org/project/views_checkboxes ?
Comment #10
zmove CreditAttribution: zmove commentedView checkboxes only allow to redefine all view filter to a given format. We should be able to define that for each exposed filter when you create a view.
Comment #11
catchbumping to views 2, can't see this happening fro views 1 apart from the contrib module.
I'm fairly sure you could also do it with hook_form_alter if you need granular customisation like this for now.
Comment #12
freakalis CreditAttribution: freakalis commentedI would also like to have checkboxes as an option per exposed filter in the View module.
Comment #13
storbaek CreditAttribution: storbaek commented+1 for checkboxes in Views.
While, I cannot get the checkboxes for views (the module) to work for exposed filters, it's a great option. It should allow both checkboxes and fields to be checked (when multiple options are allowed).
Comment #14
dejbar CreditAttribution: dejbar commentedI also would find this of great use. It would be nice to have the option to use a series of links as well.
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedThere are problems with checkboxes that make them ill suited to exposed filters due to the interaction of checkboxes and GET.
1) When using GET arguments, each checkbox has its own name. Thus, while using a select box you'll get "http://www.example.com?foo=1,2,3" with checkboxes the URL becomes "http://www.example.com?foo[1]=1&foo[2]=1&foo[3]=1".
2) 1) isn't that bad, but this one is: If no boxes are checked, FAPI will fill the checkboxes to the 'default' state rather than having no checkboxes filled, meaning you cannot have checkboxes defaulting to on. This is because if there are no checkboxes checked, nothing is sent in the URL; if nothing is sent, fapi doesn't see anything.
Because of these problems, I've decided to generally not uses checkboxes in place of select with exposed filters.
Comment #16
zmove CreditAttribution: zmove commentedHi,
Very interesting reply. What about getting checkboxes checked values with jquery and, when validating the form, transform the url in http://www.example.com?foo=1,2,3 ?
zmove
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedThere is no way for that to degrade sanely without javascript and we do want to support the non-javascript solution as much as possible.
Comment #18
Andy Inman CreditAttribution: Andy Inman commentedNew release of views_checkboxes module - http://drupal.org/node/273124 It's still not configurable on a per-view basis (that would be feasible but is it really necessary?). The global options have been extended such that, I think it will cater for the majority of requirements.
Comment #19
mattgilbert CreditAttribution: mattgilbert commented+1 for checkboxes/subscribing
Comment #20
Heilong CreditAttribution: Heilong commentedSubscribing...
Comment #21
Alexander Matveev CreditAttribution: Alexander Matveev commentedSubscribing
Comment #22
SpikeX CreditAttribution: SpikeX commentedSubscribing. Selecting options out of a list box with CTRL is so rudimentary! This needs to be a Views feature!
Comment #23
thebuckst0p CreditAttribution: thebuckst0p commentedI solved this with a custom
theme_select_as_checkboxes
function, cross-posted here: http://drupal.org/node/138374#comment-2091062Comment #24
mikeker CreditAttribution: mikeker commentedFYI: I rolled up Ben's excellent idea (see the link @23) into a simple module: Better Exposed Filters which gives you a per-filter option of using the default select box or radio buttons/checkboxes. I've tested it with Taxonomy fields, CCK fields and core node fields and would appreciate any help with additional compatibility testing or suggestions.
Thanks.
- Mike
Comment #25
thebuckst0p CreditAttribution: thebuckst0p commentedNice work! I note it on my blog here.
Comment #26
k.obrien CreditAttribution: k.obrien commentedI just enabled this module and it works great! Thanks so much! I'm thrilled.