Steps to reproduce the error:
1. Go to form_example/wizard.
2. Fill "First Name" and "Last Name" then click on Next.
4. Fill City and click on Next.
5. Click on Previous you will be on section "Extensible Wizard: Step 2".
6. Click on Previous you will be on section "Extensible Wizard: Step 1".
7. Click on Next you will be on section "Extensible Wizard: Step 2", wait a moment, the text in City field is missing.
Here the patch for fix that.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | lose_data-2598472-6.patch | 2.08 KB | sdstyles |
| lose_data.patch | 628 bytes | rpayanm |
Comments
Comment #2
rpayanmComment #5
mile23Nice catch!
form_example_wizard_next_submit()does this same thing, with the same result. Add a number for the SSN field, click 'previous' and then click 'next' and the value goes away.So we need to remove this line from
form_example_wizard_next_submit()as well. I'm not entirely sure why it's there to begin with.I think we should demonstrate how to test this kind of interaction as well. Add some steps to
FormExampleTestCase::testWizard()where we click on 'Previous' and verify that the information is still present.Marking this as Novice and Needs tests so it might find a wider audience. Assign yourself, @rpayanm, if you want to work on it.
Thanks!
Comment #6
sdstyles commentedRemoving this code from
form_example_wizard_next_submit()will brake the multi-step functionality. I found that form lose city and aunt ssn number values because Previous submit callback has attribute#limit_validation_errorsthis attribute skip validation and discard form values.This patch replace
$form_state['values']with$form_state['input']inform_example_wizard_previous_submit()this allow not to lose values in previous submit callback, also added test coverage for described steps from issue.Comment #7
navneet0693 commentedHi @rpayanm
This patch by @sdstyles works fine for me.
Test Results : Pass On "Extensible Wizard: Step 2" City value is held, after we went to "Extensible Wizard: Step 1" by hitting "Previous".
Drupal 7 Version : 7.43
MySQL : 5.5.42
PHP : 5.6.10
Comment #8
navneet0693 commentedComment #10
mile23Nice. Thanks.