0

I created a "view" on my site with 3 exposed filters (One for "name", the other for "occupation" and the last for "location") to allow users search/filter for other users on my site.

On page load, no results are displayed. However, if I simply select search/apply (without inputting any search string), it displays results.

Please, how can i resolve this?

Thanks.

7
  • Am using views to display and filter. I want to ensure that no user information is displayed when a user clicks the search button, except he/she has entered a value into the exposed filter fields. Presently if I simply click "search" all users in my database is displayed. Thanks. – seyi Jul 16 '13 at 12:45
  • By 'no user information' you mean no results, empty list or "no results" text? That should be easy to set in filter settings. – Mołot Jul 16 '13 at 13:55
  • Please can you explain further. I have 3 exposed filters. One for "name", the other for "occupation" and the last for "location". As it is, when a user clicks the search button, (without inputting any value into the 3 filter fields) all the users in my database is displayed. So now please, which of the 3 filters will I set and to what. Thanks! – seyi Jul 16 '13 at 14:06
  • If you make filter required, can you still get the result if user does not filter? Maybe I'm missing something... – Mołot Jul 16 '13 at 14:12
  • 1
    @Mołot I think he wants to not show anything until there's something present in the exposed filters fields. I think it's a tricky question, and it's probably not in the scope of Filters to do that, I know if you use "Contextual Filters" you are able to set "Display 'No results'" if filter value is not present. – Beebee Jul 16 '13 at 14:14
1

If you go to advanced settings of the view, you can set the exposed form settings to input required.

Another option if you are making use of the Better Exposed Filters, there's a patch for it which adds 'input required' option/functionality,

0

In D7, if we make the exposed filters be 'Required', we can avoide displaying default result list. But it will require you to set some default value for the exposed filter(s) out of the options 'Is equal to, Is not equal to, Regular expression etc'. Possibly the below post will help you :

How to combine views exposed filter with search?

Keep the exposed filter(s) as not Required.

Here, you need to also check for a condition in your code that (considering all the exposed filters are mandatory be set to some value, as you have expected) the url parameter(s) have values, I mean it should have a format like 'http://sitename.com/test_path?title=test_title' (Not like 'http://sitename.com/test_path?title=').

Hope it helps

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.