Posted by aprice42 on February 16, 2010 at 12:54am
Hello,
I have a view that has exposed filters. When I navigate to the view page it shows me all of the results based on the default filter settings.
I want to make the view display a blank search page (with just the exposed filters showing) when the user first visits, in essence presenting a blank search form.
Is this possible?
Thanks,
Andy

Comments
Filter Behaviour
It's the default behavior of an exposed filter to show the entries as it is set; I think it's a bit counter-intuitive for folks to have to leave the filters blank and hit apply to return all results. If the filter has a default setting, than it shows that subset.
But if you want to do it, I guess there would be two easy ways I can think of that wouldn't require writing alter code in a module.
There's a module called Views PHP filter that could be used - create a suitable PHP switch to blank the form when there are no other filters.
Alternatively, since views filters react to the query string, you could pass a bogus query string in the initial link, like mysite/myview?title=not+gonna+find+anything
I workaround I used was to
I workaround I used was to create a new block display for my view, then set "exposed form in block" to yes. Leave everything else as default.
A new block will be available you can place on a page as a starting point for your view.
-John
jQuery can be used
In my situation I was able to work around this issue with a bit of jQuery magic. Using jQuery I found the view and hid the filtered results until the Apply button is clicked. This all happens when the page is loading so the user never sees the filtered results that show up by default. Here is a code snippet:
$(function() {$('div.view-myview table.views-table').hide();
$('input#edit-submit-myview').one('click', function(e){
$('div.view-myview table.views-table').slideDown();
});
});
Now, just use drupal_add_js to add a javascript file with the above code in it from a custom module and you're golden!
This is now fixed in views 3
This is now fixed in views 3 - there are 2 kinds of filters 'basic' and 'input required'; i believe the latter is the one you want
Can I get some assistance?
I know this is an old thread, but I am at a loss.
I have exposed the Location/proximity field for zip code/distance and set it to required.
I have set the exposed form to Input Required.
However, if the user does not make a zip code entry, all the results are returned.
No results should be returned if the use does not enter a zip code. I have tried various contextual filters and settings to get this to work the way I want, but most contextual filter settings either return nothing, even if a valid zip code is entered, or return the same results (all) as if there was not a contextual filter at all.
At wits end with this one. Views 3.3 D7
James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com
For a database query with no
For a database query with no match, nothing should be retrieved from the database. Your view is making a query that returns everything as if you were matching to " ". I think you can see the query when editing a view but not sure how to change it. Tom