[support] Wrestling with node_form_submit (Drupal7)

sebastian inforazor at gmail.com
Tue Oct 18 05:47:01 UTC 2011


Thank you Trevor, I think I am getting on the right path.

On 2011-10-17 9:07 PM, Trevor Twining wrote:
> It looks like you're setting the submit handler incorrectly. Use this
> example as your guide:
>
> http://drupal.stackexchange.com/questions/9436/how-do-i-add-an-additional-submit-handler
>
> It deals with Drupal Commerce, but it covers the same issue.
>
> Also remember that particularly on the node forms, the submit handler
> can also be set on the submit button. Inspect the values found in the
> $form['values'] array and you should be able to see if that's the case.
> I'm pretty sure that's how the node submit forms are set up.
>
> Thanks,
>
> Trevor Twining
> Web Team Lead
> Points of Light Institute
> http://pointsoflight.org
>
>
> On 2011-10-17, at 12:55 AM, sebastian wrote:
>
>> 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.
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>


More information about the support mailing list