views:

224

answers:

3

Hi,

I am having trouble with a multi-step node form for a CCK content type. I set $form_state['redirect'] to a thank you page path, but it does not get redirected upon successful submission. Here is the code following documentation on the Drupal 5.x to 6.x form API at http://drupal.org/node/144132

function rnf_form_alter(&$form, &$form_state, $form_id) { // ... $form['#submit'][] = 'rnf_regret_form_submit'; }

function rnf_regret_form_submit($form, &$form_state) { $form_state['redirect'] = 'content/forget-thank-you'; }

Any help would be appreciated.

Thanks.

+1  A: 

Ny guess is that you forget to clear $form_state['storage']. It needs to be empty before redirecting will work.

googletorp
Actually I cleared it in the validate function:function rnf_regret_form_validate($form, }
... and I am redirected to the node view page after the node is created.
... but I want to be redirected to 'content/forget-thank-you' instead.
A: 

Creating a multistep node form in Drupal 6 is a world of pain. You are a lot better off creating your own form and node_submit/node_save at the end. Roping in CCK widgets into this is a bit of a challenge but not impossible.

chx
A: 

Figured it out, thanks to someone who had posted the same problem and its answer. In my code above, for node forms, the line

$form['#submit'][] = 'rnf_regret_form_submit';

should read

$form['buttons']['submit']['#submit'][] = 'rnf_regret_form_submit';