[support] Wrestling with node_form_submit (Drupal7)

sebastian inforazor at gmail.com
Mon Oct 17 04:55:41 UTC 2011


Also if I try and add:

$form_state['submit_handlers'][] = 'HOOK_submitHandler';

Inside of:

HOOK_form_alter

It just ignores it [clears it] when it comes time to save...

And replaces it with the single function call:
node_form_submit

:(

I also set the $_GET['destination'] = 'http://someplace.com';

But this is also ignored...

Still really struggling with this. Is it really this hard to redirect 
the node_save page?

Best,

Sebastian.

On 2011-10-17 10:49 AM, sebastian wrote:
> 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