User login

Making forms redirect like they're supposed to even after complex hacking

wsf_action ben$ svn commit -m "that's drupal_goto, not drupal_go_to"

wsf_action ben$ svn commit -m "drupal_goto prevents form submission... how to make redirect work????"

wsf_action ben$ svn commit -m "despite not saying so, drupal_execute does return a redirect"

function wsf_action_combined_action_submit($form_id, &$form_values) {
  $form_values['already_submitted'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  return drupal_execute('action_node_form', $form_values, $node);
}

It's back in the form_alter that we check for already submitted and give it the normal forms for processing, but it's this return statement-- rather than calling drupal_execute and calling return standalone-- that ensures we are redirected as node_form_submit intends.

Should have been able to intuit this, I guess, but I had to figure it out by working backward from drupal_execute:

http://api.drupal.org/api/function/drupal_execute/5
http://api.drupal.org/api/function/drupal_process_form/5
http://api.drupal.org/api/function/node_form_submit/5

Resolution

Searched words: 
drupal_execute form execute

Comments

Or to do it in a form_alter

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.