Multi page user registration

joblogs83 - June 16, 2009 - 15:54

Hi all

I'm looking at implementing a multi page registration form to replace the core registration form in Drupal 6, but I'm noticing the
submit handler function I'd written is not triggering when the form submits. Details of what I've done below:

* I've used the approach as demonstrated in Pro Drupal Development (Multi page forms, page 247) using the $form_state['storage']['step']
as a counter.
* I'm using hook_form_alter() to alter the 'user_register' form to my needs as I don't think you can use hook_user() to implement multi-step forms (do correct me if wrong!)
* I've written a validation handler function which does trigger each time the form submits using

$form['#validate'][] = '<modulename>_user_register_validate';

* My submit handler looks like this
$key = isset($form['#submit']) ? $key = array_search('user_register_submit', $form['#submit']) : $key = '' ;
if ($key !== FALSE) {
  unset($form['#submit'][$key]);
}
$form['#submit'] = array('<modulename>_user_register_submit') + $form['#submit'];

(If this looks familiar it's because it's from the LoginToboggan module, why re-invent the wheel!?)

* Firebug for Drupal gives me this report of my $form array:

[#submit] => array (
  [0] => [<modulename>_user_register_submit]

So as far as I can tell, I've altered the user_register form as I see fit, I've got it to validate properly and set the step variable accordingly if it fails,
but for reasons that elude me the submit handler doesn't trigger at all even though it appears it should.

Does anyone have any suggestions for this?

Thanks in advance!

 
 

Drupal is a registered trademark of Dries Buytaert.