Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the user reloads the page while using the form wizard example, the form reloads at the same step that they were on: this is correct behaviour.
However, it's easy to get this wrong, as shown by this core bug report: #1060290: Multi-step forms are prone to misbehave on refresh.
The key to doing this appears to be this code in the wizard step submit handler:
if (!empty($form_state['step_information'][$current_step]['stored_values'])) {
$form_state['values'] = $form_state['step_information'][$current_step]['stored_values'];
}
This could do with a comment to explain how it's crucial to this behaviour, so that people who's wizard is not behaving correctly can easily identify what they're doing wrong.
Comments
Comment #1
Mile23The code in the summary refers to the 7.x-1.x branch.
Comment #2
jungleNo activity for over 5 years. I am closing this. Please feel free to reopen if necessary.
Thanks!