0

I've created a Drupal 7 Views Search page. It works overall. However, when there are no returned results I want it to display a message such as 'your search returned 0 results. try something else.' So I put that message in an unfiltered text area using 'advanced > no results behavior' but now it's showing that message by default before someone has even entered their search terms.

I want the search page to only show that message once they've entered a search term in the 'search: search terms' exposed filter criteria and it actually returns no results. I don't want it to display right when they get to the page.

Anyone know how to keep that from happening?

2

I assume you are using the "On empty input: Show none" option of the search terms filter. In this case the view is actually still running but returning no results due to the filter, so you get the empty text displaying.

To stop that you can change the "Exposed form style" to "Input required".

Then the view will not run until a search term is entered, which means no unwanted empty text.

views exposed form style setting

0

I THINK I fixed it. if I turn off 'remember the last selection' for my exposed filter it seems to NOT show results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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