Posted by Morbus Iff on December 21, 2006 at 3:51pm
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | forms system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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").
Comments
#1
This would probably affect any form with these conditions (form block on one page, but not on destination page).
#2
I 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.
#3
This 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.
#4
Title change would also be appropriate. I think this one sums it up.
#5
Wow, 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.
#6
wtf @ forum.module?
#7
This can be fixed by removing code. We do not need to add anything.
#8
tested, works as it should.
#9
So this makes you stay on the same page, which essentially makes all pages showing the block search pages?
#10
#11
To 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...
#12
I believe too...
#13
This sounds good, thanks. Committed.
#14
So this bug is also present in Drupal 5 (see comment #5 and #174494). Should this patch be ported?
#15
Mark for 5.x then.
#16
Looks like this'll fix it. Needs to be ported to 4.7.x as well, from the look of http://drupal.org/node/103909.
#17
And here's one for 4.7.x.
#18
Sigh. ;) Drupal 6 making me lazy about double-checking my patches. ;)
#19
#20
Hmm. 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.
#21
Yeah, it's needs review if there's already a port.
#22
Committed to 5.x.
#23
Automatically closed -- issue fixed for two weeks with no activity.
#24
This fix broke the ability for search to work from 404 pages: http://drupal.org/node/292565#comment-1065064
#25
Still 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'
#27
Oops. :( 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)