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.
Hi, I'm using better_exposed_filters with secondary options, but there is a very annoying usability issue: after the user submits, the secondary options field always collapses.
I would like to see that after a submit, the secondary options stays open. Can this be fixed?
Comment | File | Size | Author |
---|---|---|---|
#10 | bef-1983960-10.patch | 1.17 KB | tim.plunkett |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedsame request for me
Comment #2
keesje CreditAttribution: keesje commentedRan into this problem too.
The "collapse" feature is implemented using the core form API, as supposed to.
Drawback is that there is no module-specific javascript file to patch for this.
If this is to be addressed within the module code, it should be in the "exposed_form_alter" function in "better_exposed_filters_exposed_form_plugin.inc".
$secondary['#collapsed'] is always set to TRUE. Here could be checked if there is user input in any of its containing fields.
To bypass patching you could implement this as a form_alter, checking user input to override #collapsed.
Simple example for one select filter (untested):
Comment #3
mikeker CreditAttribution: mikeker commentedBEF should be checking all the items within the secondary menu to see if any have options selected and keep the fieldset open if there are.
Marking this as a feature request -- as always, patches are welcome!
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedsorry for my stupid questions:
- where should I put the code #2?
- mymodule_form_alter: sould I replace "mymodule" with anything else?
- myfilter: sould I replace "myfilter" with anything else?
Comment #5
rp7 CreditAttribution: rp7 commentedFollowing code seems to work on my installation. Not providing a patch, since I haven't tested this thorougly (and I'm not sure if there are use cases where the $_GET key is different from the filter name).
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedit works perfectly, thanks.
Comment #7
JKingsnorth CreditAttribution: JKingsnorth commented#5 is a working workaround! Can anyone confirm whether there would be a problem in basing a patch off this approach?
Comment #8
mikeker CreditAttribution: mikeker commentedPlease be sure to include AJAX-based views in addition to filters that have a default option other than "all" set. (For the second, select an option in the configure filter dialog so that option appears as the default value when you navigate to the page with no querystring params).
And report back your results! Thanks.
Comment #9
KerriO CreditAttribution: KerriO commented#5 works for me.
Definitely seconding this as a feature request. More specifically, a set of options to select collapse behavior for secondary filters.
Comment #10
tim.plunkettThis is technically a feature request because it never worked and never claimed to, but from a UX perspective this is a major bug.
Comment #11
mikeker CreditAttribution: mikeker commented@tim.plunkett: Thank you for the patch. I've committed it -- you're right, this has been a major UX bug.
I would love to see the secondary options fieldset collapse when the selected options are returned to their defaults, though I suppose that's what the Reset button is for. :)
Comment #12
mikeker CreditAttribution: mikeker commentedComment #13
asgorobets CreditAttribution: asgorobets commentedit still collapses in cases when users change their filter identifier in Views UI. I've created a separate issue for that.
#2189321: Secondary options closed after submit if filter identifier is not left default.