Closed (fixed)
Project:
Drupal core
Version:
7.0
Component:
forms system
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Mar 2011 at 06:01 UTC
Updated:
4 Jul 2011 at 21:30 UTC
If you use a form with this redirect:
$form_state['redirect'] = "somepath/somepage#section2";
you will instead be taken to:
http://example.com/somepath/somepage%23section2
Thanks.
-Mitch Schwenk
Comments
Comment #1
tazzytazzy commentedI think I fixed this. Sorry, if this is not in the correct patch format. This is from includes/common.inc, here's an updated drupal_goto() function:
Mitch Schwenk
Comment #2
bfroehle commentedYour proposed patch in #1 would unfortunately break a lot of other functionality in Drupal, as it'd be impossible to pass in $options['query'] or $options['fragment'].
However, you can accomplish your goal without any patches by setting
This advanced form of redirect is only used a few times in Drupal core, see path_admin_form_delete_submit() for example.
Comment #3
tazzytazzy commentedThanks. That works.
Comment #5
dunx commentedI'm theming some flag_clear module links from a nodecomment under advanced_forum. I was expecting to be able to use:
The URL looks fine on the form page (http://mysite.com/flag/reset/abuse_node/9619?destination=node/9618#comme...), but it redirected back to the parent URL mysite.com/node/9618 (well, the URL alias of that page anyway) and effectively ignored the fragment. I'm assuming this is because the fragment is assumed to be for the flag/reset page, rather than retained for the destination page.
However, the following did work:
Probably the same with normal comments.
This is all under D6 BTW! Bug worth raising?