Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm finding that if I create a views with exposed filters set to required and displayed as a block is causing the normal Drupal core search (and the same for Search API search) blocks to stop working.
On submitting a search using either of these blocks the page just refreshes instead of taking you to search results. If I make the exposed filters "not required" the search blocks work again.
Comments
Comment #1
iancawthorne CreditAttribution: iancawthorne commentedIt seems that Panels is thrown into the mix here too as the exposed filter block needs to be within a panel pane to cause this issue.
Comment #2
richsky CreditAttribution: richsky commentedNot quite, I'm having this strange behavior in D6..., even without putting exposed filters in a block.
Comment #3
dawehnerIt's actually no strange behavior at all.
A exposed form is technical submitted from your browser on all pages, because it is done via the URL automatically, so if you set it to be required, it's REALLY required, simple.
Comment #4
iancawthorne CreditAttribution: iancawthorne commentedI'm not sure I understand? How can filling in an exposed form in a block and hitting submit and being bounced back to the same location with no warning or result at all be as designed?
If the field is set to un-required, the form submits fine. Surely if the field is "required" and a value has been entered, the behaviour should be the same, and if you don't enter a value you are given a message to reflect this?
Comment #5
silurius CreditAttribution: silurius commentedI am wrestling with this issue as well. Basically, Drupal Search is crippled on any pages that where there appears a view display's required text input exposed filter. Has anyone found a way to work around the problem?
The issue appears to be that these two things aren't getting along:
Search block:
<form id="search-block-form" accept-charset="UTF-8" method="post" action="/">
View exposed filter:
<form id="views-exposed-form-foo" class="jquery-once-1-processed" accept-charset="UTF-8" method="get" action="/">
I *think* that by changing action in the Search block to point to /node/search might fix this issue, but I haven't figured out how to do this just yet. (It isn't search-block-form.tpl.php, I know that much.)
Comment #6
hefox CreditAttribution: hefox commentedVerifying bug
Ended up changing to not using required in this instance