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.
Enable the search.module block. Have it show up only on node/15 (or any existing node). Type something in and click "submit" - you get redirected to search/node, but your term is ignored, nor does it show up in the primary "Enter your Keywords" block. I suspect what is happening is that, since the block does NOT show up in this page (because it's been restricted to node/15), the POST variable it sent along ("search_block_form_keys") is being treated as unknown (ie., "well, there's no form on this page that uses it, so it's garbage").
Comment | File | Size | Author |
---|---|---|---|
#18 | search-block-pass-term-47x-104662-18.patch | 779 bytes | webchick |
#17 | search-block-pass-term-47x-104662-17.patch | 1.48 KB | webchick |
#16 | search-block-pass-term-5x-104662-16.patch | 783 bytes | webchick |
#7 | search_old-104662-7.patch | 918 bytes | chx |
Comments
Comment #1
Morbus IffThis would probably affect any form with these conditions (form block on one page, but not on destination page).
Comment #2
krewemaynard CreditAttribution: krewemaynard commentedI was having trouble with this in 5.0 RC-1, and I still have the same problem now using the final 5.0 release. If I limit the search module to a specific node, any search will take you to the search module itself, not the results. You have to re-do your search to get it to work.
Comment #3
cburschkaThis is either a block.module or a Forms API issue. I'm tending to the latter, since it applies to any form not present on the page its action refers to.
Something very similar happens if you disable the user login block on some pages.
Very simple, though possibly change-intensive fix: Forms API should detect if a given form ID was submitted and call the appropriate submission handler, even if drupal_get_form() wasn't called on this particular form on the target page.
Comment #4
cburschkaTitle change would also be appropriate. I think this one sums it up.
Comment #5
webchickWow, nice. We're getting this bug on a site where the search block is on the front page, but not on any other pages. When I enter a term, it redirects to just search/node, not search/node/X.
FWIW, this broke in 5.x. 4.7.x behaved fine.
Comment #6
webchickwtf @ forum.module?
Comment #7
chx CreditAttribution: chx commentedThis can be fixed by removing code. We do not need to add anything.
Comment #8
snufkin CreditAttribution: snufkin commentedtested, works as it should.
Comment #9
Gábor HojtsySo this makes you stay on the same page, which essentially makes all pages showing the block search pages?
Comment #10
Gábor HojtsyComment #11
cburschkaTo help clear up a confusion that I felt before testing and examining this more closely:
Removing the #action value does not have any effect on where search results are displayed. A search query consists of two HTTP requests:
1. The user submits the form via POST (first request)
2. The _submit function builds a search query URL ("search/node/[term]").
3. The site redirects the user to this URL (second request)
The #action value controls only the target of the first POST request, invisible to the user. The user still ends up on search/node/[term] once the POST is processed and redirected. I believe that solves the problem quite elegantly...
Comment #12
chx CreditAttribution: chx commentedI believe too...
Comment #13
Gábor HojtsyThis sounds good, thanks. Committed.
Comment #14
zoo33 CreditAttribution: zoo33 commentedSo this bug is also present in Drupal 5 (see comment #5 and #174494). Should this patch be ported?
Comment #15
Gábor HojtsyMark for 5.x then.
Comment #16
webchickLooks like this'll fix it. Needs to be ported to 4.7.x as well, from the look of http://drupal.org/node/103909.
Comment #17
webchickAnd here's one for 4.7.x.
Comment #18
webchickSigh. ;) Drupal 6 making me lazy about double-checking my patches. ;)
Comment #19
robertDouglass CreditAttribution: robertDouglass commentedComment #20
robertDouglass CreditAttribution: robertDouglass commentedHmm. Now I don't know: is "patch (to be ported)" the right status for this since webchick has already ported the patch? Or was it right with "patch (needs review)"?
Anyway, seems like this deserves some attention from Drumm.
Comment #21
webchickYeah, it's needs review if there's already a port.
Comment #22
drummCommitted to 5.x.
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #24
Jody LynnThis fix broke the ability for search to work from 404 pages: http://drupal.org/node/292565#comment-1065064
Comment #25
fmitchell CreditAttribution: fmitchell commentedStill not passing the search terms in Drupal 6.6. No $form['#action'] in search.module (Acquia version).
You can test at http://brightplum.hobby-site.com/where2hoop/
Search term 'Ray Meyer'
Comment #27
webchickOops. :( Sorry. :(
Marking this back to closed, since this is being handled over at #292565: Regression: Can't set /user to 403 page (was: login destination is broken)