0

I know how to expose the Views exposed form on a block but what I would like is for the results from the exposed filter be shown as a separate block.

For example:

User will go to www.example.com/search_names On this page they will see an exposed filter where they can enter a name and hit Apply After the user clicks Apply the results are shown in a different block.

Thanks for any help.


I'm thinking that I may be missing a step in the process. Here are the steps I am taking and the order I am doing them:

  1. Add New View and click on CREATE BLOCK on the Add New View page. (Both have display format of GRID)

  2. I add my fields that I want to show in the filter result.

  3. I add my Filter Critea and choose "Expose this filter to visitors, to allow them to change it "

  4. I click on Advanced and under Expose Form In Block I choose YES.

  5. Under Exposed Form Style I choose Input required.

  6. Under Use Ajax I choose Yes.

  7. At this point, in the Preview section I no longer see my Filter Critea.

  8. I save my View.

  9. I now go to Structure then Blocks and can see 2 new blocks under Disabled: Exposed form: view_name-page and View: view_name

  10. I assume that the one starting in Exposed form is the Filter Critea (where the user can put in the search paramater) and the one starting in View will be where the results of the Filter will be shown.

  11. I place the Exposed Form block in the Content area of my theme and under Pages I input the node where I want this block to ONLY appear in. (In my case node/109).

  12. I go back to the Blocks page and then place the View in the Content Area of my them and under Pages I input a different node where the results will be shown. The reason I have a different node is because on this node I have text that pertains to the filtered result.

I go to the node where I have the Exposed Form (node/109) and see the Filter Request. I type what I am searching for and hit apply. The results IS NOT appearing under the node where I placed the View block. Why is this?

Thanks for any help.

  • The answers below are correct, this set of steps uses a filter block and a View block. The exposed filters block can only redirect to a Page display, this seems like you were trying to redirect it to a node that had a View block on it. If you need this kind of functionality you should check out Panels. – Ryan Price Feb 24 '18 at 16:25
1

This has worked for me:

  • Make a View Page with the fields, filters and exposed filters you want. Make the view work with exposed fields in the Views Admin UI. In the view settings assign a page url.
  • When done with the above step, click the Exposed Form block in the advanced view settings (make a block of the exposed filters).
  • Then goto the Admin Blocks UI for your drupal site and place the block on whatever URL and theme Region you want. I placed my exposed form block on a Panel page.

When the filter form is used, it POSTS to the Views page URL within your view. You can't just make views block(s) for the display and exposed filter form(s). A block does not know from within Views where the <form action="SOME_URL_HERE" method="POST" /> url of the form should post to.

For example, the exposed form on some page

enter image description here

The result of submitting the form

enter image description here

0

Assuming Drupal 7.x and Views 3.x here.

Exposed filters separated into blocks exist as an option for Views Page displays. To separate exposed filters for a Block display, look at using the Views Block Exposed Filter Blocks module.

Via this method, your search_names callback could be generated by the same or another view, or any other module, and you would load both the "Exposed form" block and the "View" block on that path via the blocks admin page.

Note though that there is currently a dependency on AJAX for the operation of this filter; you'll need to set "Use AJAX: Yes" in the block.

  • Thank you for the link to the module. Unfortunately this did not work for me - or at least - did not do what I needed. I am using Views 7.x-3.7+23-dev and Drupal 7.x. – penone Apr 14 '14 at 20:42

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.