As we are now capable of stacking '#submit' callbacks on forms, we might want to trigger actions on succesful form submission, but
at the moment a lot of _submit functions execute a drupal_goto, which would stop the rest of the actions from executing.

This patch moves the drupal_goto out of the submit functions, and instead allow them to return a path to redirect to.

CommentFileSizeAuthor
submit_goto.patch12.39 KBadrian
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

code reviewed and tested. works well and helps developers a ton.

rkerr’s picture

Patch applies with offsets. Have tested comment form, node form, login... and everything still seems to work normally.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
Dries’s picture

Status: Reviewed & tested by the community » Active

Committed to HEAD. Thanks. Should this be documented/announced somewhere?

ax’s picture

this should definitely be documented/announced somewhere: at the modules update page, and somewhere in the forms-api-docs (you know better than me where exactly). thanks!

energie’s picture

Category: bug » support

Is it possible that the following problem is in connection with these changes?
http://drupal.org/node/49279

I try to explain the problem in the next example (flexinode module).

step 1. page "admin/node/types" has a hidden field named "ctype_id"
step 2. page "admin/node/types" is submitted to "admin/node/field" page. The target doesn't do anything with the submitted data now, it just put them in hidden fields to save for the next submission, but does not get this variable.
step 3. "admin/node/field" submits data that has missing fields because data is lost one step before.

http log:
"POST /?q=en/admin/node/field/ HTTP/1.1" 302 -
"GET /?q=en/admin/node/field HTTP/1.1" 200 9488

First data is submitted, no action is taken, then immediately redirected, post variables are lost.

I hope I was clear with this description.

pkls’s picture

I think this problem also arose due to these changes: http://drupal.org/node/49123

The search in locale admin settings is failing because of the dropped POST variables during a drupal_goto.

moshe weitzman’s picture

Priority: Critical » Normal
Status: Active » Closed (fixed)

see http://drupal.org/node/49799 for problems with locale search, node search, etc.