I created a custom post type with field groups, then created a view for it with custom search.
Everything works perfectly - except I want the views output to display only the filtered results - meaning, at first it will display nothing except the search form, and then after filtering pressing the submit button it will show the results.
I tried to "display only search form" in the shortcode, but then i NEVER get the results.
* naturally - I DON'T want the results to appear on a different page.
I thought I could maybe try a view with pagination, and show only 1 result per page. It ALMOST worked. I mean, it works, but for some reason with this view, after I change the last parameter (year of questiuonaire) once (for example from 2006 to 2008), it never goes back to 2006.
you can see the paginated form here:
hidden link
and the unpaginated form (which shows all answers - i currently have only 2) here:
Google searches start with nothing until you give it search terms for which it retrieves results.
Views custom searches work the opposite way, more like browsing Amazon departments, in that they start with all results and narrow these down as you apply filters.
The only option whereby the search form is displayed initially with no results is to split the form and the results onto separate pages. You say that, naturally, you don't want to do this, but actually there is no other choice.
Not that your users are likely to notice that the url changes as the page updates with the search results. And on the results page the search form (including the filter settings) will also be rendered, so that users are able to update their search by adjusting the filters.
So create a page for your search and another for the search results, and then when you insert your search view into the first page using the Fields and Views button, follow the instructions for splitting the form and results on separate pages.
hey,
thanks for the reply.
the reason i don't want to do it in a different page is that the search form is within a tab within a page (or it would be, after i solve this issue).
i am thinking about 2 workarounds:
1. pagination, showing only 1 result per page. i tried this, and it ALMOST works. "almost" - because it ALWAYS shows me all results after filtering (and spreads them across pages, 1 result per page). If I could only make it show the RELEVANT results, it would be perfect.
2. some sort of jquery solution to hide the results div if there are more than 1 results in it - but i don't know jquery...