1

I have a fairly straightforward view, which exposes a simple keyword filter to the user.

Currently, when I first land on the page containing this view, all records are displayed (i.e., the search results are unfiltered).

How can I alter this behavior, so that no search results are displayed until the user has entered a keyword and submitted the form?

(I'm converting an old Drupal 7 site to Drupal 8. On the D7 site, the view does not show search results when I first land on the page. Is this a difference in behavior between the Views implementation in D7 and D8? I can't find anything in the D7 site to suggest that this difference in behavior is caused by a module.)

2
  • 1
    Could you just make the keyword filter required?
    – Clive
    Jun 2, 2020 at 18:43
  • Thanks for the suggestion. I tried this, but it resulted in the "no results found" message being displayed on the initial page view, which isn't what I want. Jun 3, 2020 at 12:42

1 Answer 1

3

You can change that under Advanced Views options (third column): Exposed form style:

Views Exposed Form options

After you choose Input required, you can adjust further options, including the text to display before any filters are active:

Views Input Required Settings


If you're using Better Exposed Filters module it has an option for it too:

Input required
Only display results after the user has selected a filter option.


It hasn't changed since D7, it works the same in D8 as it did in D7.

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.