0

Scenario:

View fields:

name
gender
age
especialty

exposed form block (1) fields:

name
especialty

exposed form block (2) fields: (This is also I want to have but as a separate block)

 name
 age
 gender

I am looking for a way in which I can have two different exposed form blocks but with different search fields.

I am using Drupal 8. Any help would be appreciated. Thanks!

  • You'll probably need to make 2 custom forms in code and a custom block for each form to display them. Then in your form submits you'll need to replicate the url parameters views would normally do e.g. ?field_my_field=2&field_my_field2=aaa – Leigh Jan 10 at 14:25
  • in addition to the @Leigh suggestion (which is great, I did it this way too a month ago) do not forget to add redirect on form submit to the views path with $_GET params, views exposed filter should be detached anyway so expose in block = yes in views advanced config but not show the block anywhere. – svetlio Jan 10 at 15:54
  • The "interface" solution could be to Duplicate the Views Page, keep the same Path setting, but override the Exposed Filters so you end up with two different Exposed form blocks. That way you have two Exposed filter Blocks working on the same page. – prkos Jan 11 at 12:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.