I'm using BEF (Better Exposed Filters) and I want to this simple thing:

Whenever the button Submit (from the views exposed form) is clicked, all filter must be collapsed (must close).

What is the best way to achieve this?

1 Answer 1


The default BEF behavior reloads the entire page after clicking the "Submit" button (at least on D8 - it's been a while since I've worked with BEF on D7). This means you can just add styles + js to have the form collapsed when the page loads; they can expand the form, choose their options, click "Submit", and the form will be closed again when the page re-loads.

If you have a different behavior on your site - i.e. filters that upload the view live, without having to refresh the page - use JS with an .on(click) function to add a "collapsed" class to your form, and use the same styles + js mentioned above to collapse the form.

  • hi, thank you for your answer. I found out that this is happening because I am using exposed form in a block... I'll try what you said... thanks Jul 11, 2017 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.