1 form_example_wizard.inc form_example_wizard_previous_submit($form, &$form_state)

Submit handler for the "previous" button.

This function:

  • Stores away $form_state['values']
  • Decrements the step counter
  • Replaces $form_state['values'] with the values from the previous state.
  • Forces form rebuild.

You are not required to change this function.

Related topics

File

modules/examples/form_example/form_example_wizard.inc, line 156
Extensible wizard form example.

Code

function form_example_wizard_previous_submit($form, &$form_state) {
  $current_step = &$form_state['step'];
  $form_state['step_information'][$current_step]['stored_values'] = $form_state['values'];
  if ($current_step > 1) {
    $current_step--;
    $form_state['values'] = $form_state['step_information'][$current_step]['stored_values'];
  }
  $form_state['rebuild'] = TRUE;
}