Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Prevent committing values while going back and empty invalid resubmitted steps #72

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mficzel
Copy link
Member

@mficzel mficzel commented Dec 10, 2021

Navigation back and forth in multi step forms had some issues:

Back navigations would commit the entered values when valid:

The __target argument that was used for the navigation of multistep forms did make no distinction between back and forth navigating. This change alters the behavior and prevents committing when __target is

prefixed with an exclamation mark.

If invalid data was committed for an already committed step no message is shown but the old data is used silently.

Previously committed steps were only replaced when a new valid state was submitted. This is unexpected as the user had changed the values and expects the new state to be submitted.
With this change a step is overwritten when submitted again with valid data- If invalid data is submitted the step data is removed and the used will see the validation messages.

MarcoPNS and others added 4 commits November 3, 2021 11:56
Previously, an already validated step was not validated again when resending. This happens now.

Co-Authored-By: arsors <[email protected]>
… forms.

The __target argument that was used for the navigation of multistep forms did make no distinction between back and forth navigating which. This change alters the behavior and prevents committing when __target is prefixed with an exclamation mark.
…th invalid values

Previously already committed steps were only replaced when a new valid state was pushed.
This was unexpected as the user had changed the values and expects the new state to be submitted.
With this change a step is overwritten when submitted again with valid data or removed otherwise.
@mficzel mficzel force-pushed the bugfix/preventComittingValuesWhileGoingBackInMultiStepForms branch from 98bfedb to e4ee2dc Compare December 10, 2021 17:24
@mficzel mficzel changed the title comitting values while going back in multi step forms BUGFIX: Prevent committing values while going back and empty invalid resubmitted steps Dec 10, 2021
@mficzel
Copy link
Member Author

mficzel commented Dec 10, 2021

@MarcoPNS it would be great if you could test this with your use case.

@MarcoPNS
Copy link

Hi! Thanks for your additional change. This seems to keep the MultiStepForm working as it did with my PR ✌️

@bwaidelich
Copy link
Member

I can confirm that this fixes the bug, but it will reset the complete form step once you navigate back and forth:

Steps to reproduce:

  1. In the MultiStepForm example form navigate until step 3
  2. navigate back, remove value of street
  3. try to submit => error as expected
  4. navigate back to step 1
  5. navigate forward to step 2

Expected

Value for street is still empty while city still contains the previously submitted data

Actual

All form fields of step 2 are reset

@mficzel
Copy link
Member Author

mficzel commented Jan 17, 2022

@bwaidelich thanks for testing, i can confirm your findings. Seems we need a way to persist also the invalid submitted values. This will take some time to do right. Regards Martin

@bwaidelich bwaidelich removed their request for review January 17, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants