'checkboxes_example', 'title' => t('Checkboxes Example'), 'description' => t(''), 'callback' => 'drupal_get_form', 'callback arguments' => array('checkboxes_example_form'), 'access' => user_access('view checkboxes'), 'type' => MENU_NORMAL_ITEM, ); } return $items; } function checkboxes_example_form($form_values = NULL) { if (!isset($form_values)) { $step = 1; } else { $step = $form_values['step'] + 1; } $form['step'] = array( '#type' => 'hidden', '#value' => $step, ); switch ($step) { case 1: $form['message'] = array( '#type' => 'item', '#title' => t('Page'), '#value' => t('This is the first page of a multistep form.'), ); if (CHECKBOX_EXAMPLE_MULTIPAGE == 1) { $form['submit'] = array( '#type' => 'submit', '#value' => t('Next'), ); break; } case 2: $form['message'] = array( '#type' => 'item', '#title' => t('Page'), '#value' => t('This is the second page of a multistep form.'), ); $form['checks'] = array( '#type' => 'checkboxes', '#title' => t('Some options'), '#description' => t('Items 3 and 5 should be checked'), '#options' => array( 1 => t('Item 1'), 2 => t('Item 2'), 3 => t('Item 3'), 4 => t('Item 4'), 5 => t('Item 5'), ), '#default_value' => array(3, 5), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), ); break; } if (CHECKBOX_EXAMPLE_MULTIPAGE == 1) { $form['#redirect'] = FALSE; $form['#multistep'] = TRUE; } return $form; } function checkboxes_example_form_submit($form_id, $form_values) { }