Wizard example bug - validation between steps
See original GitHub issueAre you submitting a bug report or a feature request?
🐛
What is the current behavior?
- Fill in firstName and lastName to be able to proceed to step 2
- Don’t touch any field, go back to Step 1
- Don’t touch any field, go forward to Step 2 <---- Don’t allow me to
- Step 2 is validated at render-time, so it’s invalid at the start (check console log to see that
validate()
was called) - Going back doesn’t stop me, even if that step 2 is invalid
- Going forward stops me, even if step 1 is valid (but step 2 isn’t)
What is the expected behavior?
- Allowing me to go to step 2 -> 1 -> 2
- Only validating the current step unless I’m on the last step, then validate the full thing?
Sandbox Link
Official example from docs: https://codesandbox.io/s/github/final-form/react-final-form/tree/master/examples/wizard?from-embed
My version: https://codesandbox.io/s/wizard-example-iqycj
What I changed:
- Removed per-field-validation on
firstName
andlastName
and handled them in thevalidate()
function (same as step 2 validations)
What’s your environment?
"final-form": "4.18.5",
"react-final-form": "6.3.0",
Other
I understand that it’s up to us to handle the validations, and that final-form only provides the validate
prop, but as this example is official in your docs, I assume it should work.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Wizard Form Example - Redux Form
Wizard Form. One common UI design pattern is to separate a single form out into sepearate pages of inputs, commonly known as a...
Read more >Unobtrusive validation with Jquery Steps Wizard
I want to validate the form in the onStepChanging function of jquery-steps, $("#my-steps"). steps({ headerTag: "h3", bodyTag: "section", contentMode: "async", ...
Read more >Wizard plugin - FormValidation
The best validation library for JavaScript. No dependency. Supports popular frameworks including Bootstrap, Zurb Foundation, Pure, Semantic, UIKit, Bulma, ...
Read more >33 Understanding Wizard Controls
Data can be passed in one of three ways: from page to wizard form (child to ... process to succeed, even hidden and...
Read more >Advanced Usage - React Hook Form
The following code example works as intended for validation; however, ... able to build a wizard form/funnel to collect user input data from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Update: While trying to refactor, I accidentally made a change that actually fixed the bug
Before:
After:
PS: I have actually no idea why this fixed it. It seems like it should behave the same…? But after applying this fix; I’ve played around with the form trying to reproduce the bug, and I CAN’T 😃 Reverting it, would immediately reproduce it.
@kg-currenxie No worries mate i fixed it, you were right about the validate. Thing is I was using the Wizard as well, so I had to set it up properly in both places. Got it working 😃. Thanks though!