Closed (fixed)
Project:
Examples for Developers
Version:
7.x-1.x-dev
Component:
Form Example
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2011 at 12:46 UTC
Updated:
5 Sep 2012 at 00:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedPatch as promised in the issue above.
Comment #2
Anonymous (not verified) commentedActually, it looks like the original issue I was having wasn't related to it being a string value vs an array.
Comment #3
rfayYeah, actually, if you look at use of $form_state['redirect'] in core, it's almost always a string, but it can be used as an array to pass extra args to drupal_goto().
Comment #4
bfroehle commentedActually, I'd suggest having an example where $form_state['redirect'] is an array.
This is feature confusing and poorly documented -- see #1095588: Form redirect w/ anchor causes problems - $form_state['redirect'] = "somepath/somepage#section2"; for example.
Comment #5
bfroehle commentedSee attached patch, which just adds another comment block describing advanced usage of $form_state['redirect'].
Comment #6
rfayI don't mind adding this into an example, but the key fix here is to improve the documentation. I think http://api.drupal.org/api/drupal/includes--form.inc/group/form_api/7 could be better. Even the (referred) http://api.drupal.org/api/drupal/includes--form.inc/function/drupal_redi... doesn't deal straight with this.
Would you mind chasing it in the documentation?
Comment #7
rfayx-post...
1. query is an array of name-value pairs: 'query' => array('foo' => 1)
2. Your patch needs to say in the comment what URL it would be redirecting to. In your example "The following would redirect to node?foo=1#bar" or something like that.
It can also mention that there are many other things supported by drupal_goto().
Thanks!
Comment #8
bfroehle commentedIssue created, see #1096448: drupal_redirect_form needs better documentation of $form_state['redirect']
Comment #9
q0rban commentedHere's an updated patch that addresses Randy's items in #7.
Comment #10
mile23Very much way better commenting. :-)
Committed: http://drupalcode.org/project/examples.git/commitdiff/ed5bc430e36313cde5...
Thanks!