Drupal 6 CCK node form redirect issue
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.
Than开发者_StackOverflow中文版ks.
Ny guess is that you forget to clear $form_state['storage']. It needs to be empty before redirecting will work.
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.
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';
精彩评论