[support] Wrestling with node_form_submit (Drupal7)

sebastian inforazor at gmail.com
Mon Oct 17 03:49:28 UTC 2011


Hello there,

I have a form which I am changing with:

HOOK_form_page_node_form_alter(&$form, &$form_state, $form_id) {
}

I have set:
$form_state['redirect'] = http://something.com

I can confirm that:
$form_state['programmed'] = false;
$form_state['rebuild'] = false;
$form_state['no_redirect'] = false;

And:
$_REQUEST['destination'] = http://something.com

When I reach the function:

node_form_submit

It blatantly does:
if ($node->nid) {
     $form_state['redirect'] = 'node/' . $node->nid;
}

And thus destroys all my hard work at making a redirect...

How can I hook into this process to either STOP node_form_submit from 
changing my ['redirect'] back to '/node'

OR

How can I make the node save event trigger my $_REQUEST['destination'] 
instead of: drupal_redirect_form($form_state)

Since the value that drupal_redirect_form($form_state) get's is wrong as 
node_form_submit screwed with it at the very last step of the process.

I have read:
http://api.drupal.org/api/drupal/includes--form.inc/function/drupal_redirect_form/7
This doesn't seem to work in D7 either:
http://www.brianvuyk.com/story-type/changing-redirect-value-drupal-node-form-d6

Totally baffled... I'm either missing something in the flow of the form 
save process [where to actually hook it] or something is wrong with 
D7... [probably the former as I am still a young padawan]

Thanks for your help!!

best,

Sebastian.


More information about the support mailing list