Thursday, 27 January 2011

No form output with Chaos Tools multi-step form wizard

Hey this is my thrilling new Drupal 7 blog - it's for hints and tips and Drupal philosophy which I'll add as I go along.

So here's something on the Chaos Tools multi-step form implementation which might easily catch you out and leave you swearing at the screen for an hour or two (like it did me):

So, are you wondering why your D7 multi-step form doesn't produce any output at all?

The form step builders must "return $form;" instead of having the form passed by reference:

<?php
function mymodule_step_form($form, &$form_state) {
// add my fields
return $form;
}
?>

Hope that saves others some time.

I also posted this in the Chaos Tools issue queue here.

No comments: