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.
When you have multiple facets on a search page you get for each facet a submit button.
It would be nice if you could have 1 submit button at the bottom
Comment | File | Size | Author |
---|---|---|---|
#9 | facets-autosubmitdropdown-2656856-9-8.patch | 3.99 KB | bc |
#8 | facets-autosubmitdropdown-2656856-8-8.patch | 4.79 KB | bc |
Comments
Comment #2
borisson_There was a very involved discussion about this issue in irc, I remember. See https://www.drupal.org/node/2596337#comment-10687148 for more information.
So I think we should add some javascript that does autosubmitting and hides the buttons. Will that resolve your problem?
Comment #3
michiellucas CreditAttribution: michiellucas as a volunteer and commentedI think that sounds great !
Comment #4
bc CreditAttribution: bc commentedI'd like to solve this by offering a configuration setting for the dropdown facet block to submit that facet's form as soon as you select an option.
The way I'm thinking of implementing this is to provide a js library that reads drupal settings to see which facet blocks should autosubmit, find those elements in `context`, hide their submit buttons, and attach a js listener for the `` that submits the form once it changes.
This doesn't satisfy the OP's desire to have one single submit button for all facets, but it's kinda related :)
Comment #5
borisson_Over in Checkbox widget does not enable multiple facet's values at a time, we decided to change the checkboxes widget to a fake form. That'd be the same as in d7. If we can get some agreement over in that issue, we can just close this one. That's an easier solution than #4.
Comment #6
bc CreditAttribution: bc commentedThey're kinda different use cases though -- the checkbox & dropdown widgets offer different UX, and in my case the client wants dropdowns. I can open another issue for the autosubmit dropdown widget config option.
Comment #7
bc CreditAttribution: bc commentedHere's my work, so far: https://github.com/bnchdrff/facets/compare/8.x-1.x...autosubmitdropdown?...
I'm going to add a test that at least ensures the javascript is attached to the form & drupalSettings are set correctly for facets with the option enabled.
Comment #8
bc CreditAttribution: bc commentedI've added a test for the autosubmit dropdown setting. Hopefully this setting can be useful to other facets users.
I didn't write a test for the javascript code.
Let me know what I can do to get this integrated in to the module, or alternatively if it'd make sense to offer as a separate plugin or something.
Comment #9
bc CreditAttribution: bc commentedremoved xdebug_break call from patch...
Comment #10
StryKaizerThis is not relevant anymore as #2658678: Checkbox widget does not enable multiple facet's values at a time was committed.
In this issue we moved from default forms (POST) to javascript checkboxes to ensure GET requests for performance.
Those checkboxes degrade nicely into links for non-javascript clients, and do auto-submit (instead of a button) once clicked.
Comment #11
StryKaizer