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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michiellucas created an issue. See original summary.

borisson_’s picture

Title: Checkboxes - having multiple facets provide option to have 1 submit knop » Checkboxes - having multiple facets provide option to have 1 submit button

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.

borisson_: So my only problem with that solution is that we'd be creating a form per facet block.
Nick_vh: and why is that a problem?
borisson_: not a technical problem, i think it's weird UX to have 5 submit buttons in a sidebar.
Nick_vh: borisson_: that’s pure for testing purposes and for those weirdo’s that do not have JS
Nick_vh: but it does follow the Drupal convention in the sense that it needs to work without JS
StryKaizer: borisson_ : thats no issue indeed
StryKaizer: you even SHOULD have those buttons
StryKaizer: coolblue has them too, when no JS is available

So I think we should add some javascript that does autosubmitting and hides the buttons. Will that resolve your problem?

michiellucas’s picture

I think that sounds great !

bc’s picture

I'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 :)

borisson_’s picture

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.

bc’s picture

They'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.

bc’s picture

Here'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.

bc’s picture

I'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.

bc’s picture

removed xdebug_break call from patch...

StryKaizer’s picture

Status: Active » Fixed

This 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.

StryKaizer’s picture

Status: Fixed » Closed (won't fix)