You are here

Creating multi-step node forms using Multistep Nodeform module

Recently I found multistep nodeform a very good module in Drupal 6 that makes multi step node form easy. You can manage steps with this module in almost the same way you manage CCK Fields and Groups. Basically what this module does is using $form_state[‘rebuild’] and $form_state[‘storage’] to reload node form for each step and stores all submitted data. All changes made to the node form are not saved to the database until you click the save button in final step.

To install this module, just download it from to your Drupal site and enable it. Go to the content type administration (Administer >> Content >> Types) and click “edit” for the desired content type. There will be a “Manage-steps” tab shown if the module has been enabled correctly. After adding a tab you can drag it to the position you like and move fields into the step. If you are using the great features module, you will be able to export each step into code. And there are also known problems if you use some other modules such as conditional fields together with this module. Known issues are: - Validation and JavaScript of conditional fields are not being added. - Controlled conditional fields were not being saved correctly. Here is how I fixed them

/* Implement hook_form_alter */
function YOUR_MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
   $form['#after_build'][] = '_customized_after_build_callback';
   $form['#validate'][] = '_customized_validate_callback';

/* remove conditional_fields validation callback */
function _customized_after_build_callback($form, $form_state) {
   if(in_array('conditional_fields_node_form_validate', $form['#validate'])) {
      array_splice($form['#validate'], in_array('conditional_fields_node_form_validate', $form['#validate']) - 1, 1);
   return $form;

/* load conditional_fields validate function & js manually */
function _customized_validate_callback(($form, &$form_state) {
   if (module_exists('conditional_fields')) {
      $original_form_state = $form_state;
      conditional_fields_node_form_validate($form, $form_state);
      $form_state = $original_form_state;		

Thanks for reading!

Appnovation Technologies