batch_example_multistep_form_submit

6 batch_example.module batch_example_multistep_form_submit($form, &$form_state)

Related topics

File

batch_example/batch_example.module, line 123
This is an example outlining how a module can define batches.

Code

function batch_example_multistep_form_submit($form, &$form_state) {
  $step = isset($form_state['storage']['step']) ? $form_state['storage']['step'] : 1;

  switch ($step) {
    case 1:
      drupal_set_message('step 1 submitted');
      batch_set(batch_example_batch_1());
      break;
    case 2:
      drupal_set_message('step 2 submitted');
      batch_set(batch_example_batch_2());
      // this does not seem to work ?
      $form_state['redirect'] = 'batch_example/example_3';
      break;
  }

  $form_state['storage']['step'] = $step + 1;
}
Login or register to post comments