As per the forms api quick start guide, a _submit function should return the url to be redirected to and not use drupal_goto directly.

http://api.drupal.org/api/file/developer/topics/forms_api.html/5
Look under the section labeled "Submitting Forms", bullet number 4:

The return value of the _submit function will be the target of a drupal_goto; every form is redirected after a submit. If you return nothing, the form will simply be redirected to itself after a submit.

Wrong:

function myform_submit($form, $form_values) {
  // do your thing
  drupal_goto('somwhere');
}

Good:

function myform_submit($form, $form_values) {
  // do your thing
  return 'somwhere';
}

There are various forms _submit() function in the mysite module which are calling drupal_goto() instead of returning.
This means that I cannot use hook_form_alter() and override the destination by altering $form['#redirect'] like I am supposed to.
http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...

CommentFileSizeAuthor
#7 521246-extended.patch6.98 KBagentrickard
#1 521246.patch2.6 KBroychri
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roychri’s picture

Status: Active » Needs review
FileSize
2.6 KB

Here is proposed patch

agentrickard’s picture

Looks good. Does it break anything?

roychri’s picture

I did not take the time to do full suite of tests.
Does it even have a suite of unit test for d5?

agentrickard’s picture

Good old fashioned form clicking is the only way to go. The only thing I could see breaking is the fake multi-step form stuff in edit and settings, but I don't see that affected here.

Those gotos(), btw, are a legacy of 4.7.x, I think.

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. I will roll a new release.

agentrickard’s picture

Status: Reviewed & tested by the community » Needs work

Actually, there are instances of these all over the Type includes as well.

agentrickard’s picture

Status: Needs work » Needs review
FileSize
6.98 KB

Here's an extended patch. One good review and I'll roll a new realease.

agentrickard’s picture

Status: Needs review » Closed (won't fix)