Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Validation skipping steps when previously visited #37

Closed
DrPandalot opened this issue Aug 21, 2017 · 6 comments
Closed

Validation skipping steps when previously visited #37

DrPandalot opened this issue Aug 21, 2017 · 6 comments

Comments

@DrPandalot
Copy link

Repro steps:

  1. use Fiddle
  2. enter data in all fields of step 1, this will unlock step 2
  3. enter data in all fields of step 2, this will unlock step 3
  4. go back to step 2, clear any mandatory field
  5. go to step 1
  6. See that step 3 is accessible while step 2 does not validate.
@cristijora
Copy link
Collaborator

Thanks for reporting @doodlepants
Maybe all steps between step X and step Y should be validated if X < Y.
So in this case, when going from 1 to 3, both step 1 and 2 should be validated. What do you think ?

@DrPandalot
Copy link
Author

DrPandalot commented Aug 22, 2017

I agree! A good approach is often the simplest. I don't think re-validating intermediate steps is overkill.
This validation could be done of all subsequent steps when going back to a previous step, it has the added bonus of providing each steps with an accurate feedback. Be it Ok / Error / Unavailable due to previous step error.
I'd be happy to provide some schematic or help ( if I can, git is still very new to me ) :)

@cristijora
Copy link
Collaborator

cristijora commented Aug 23, 2017

Sure. Any help would be appreciated. I'm wondering where should the validation stop in the case discussed above:

So we have
1 2 3 4

Step 2 is invalid and the user is on step 1. He wants to go straight to 3 but 2 is invalid. I am assuming that after validation he should be redirected to the first invalid step,

1 - > 3
1 2 3 4

@cristijora
Copy link
Collaborator

I will find some time to do this by the end of the week.

@cristijora
Copy link
Collaborator

Actually this seemed quite easy to implement (5 lines of code 😄 )

@cristijora
Copy link
Collaborator

@doodlepants See the same fiddle from above. It should validate all steps when going from a step to another where the difference between them is greater than 1 step.
https://jsfiddle.net/CristiJ/bt5dhqtf/286/

Therefore, you will not be allowed to jump to any step without validating everything which I think is good

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants