What is the best way to create a multistep form?
Would be awesome to have an example in thedocs.
I have tried a few different ways but none seem great.
The most promising one was to use on submit + validators on the individual fields. But this doesn't work because if the user navigates to page 2, doesn't fill anything out then goes back to page 1. He is now locked out of the form because the page 2 fields are in the form state....
2 Replies
national-gold•2w ago
tancn
TanCN - Form and Table Builder
Help you Quickly Scaffold Forms and Tables using TanStack Libraries
foreign-sapphireOP•6d ago
Thank you so much for sharing this! Super interesting and useful. Unfortunatly it didn't answer my question completely. Still not 100% clear to me how errors are meant to be propagated to the field values. From the lib you mentioned:
So on fail of validation it doesn't seem like it is actually providing input to the user. Unless I'm missing something
I figured it out. It uses dybamic. Duplicares the validation logic across submit and next step and on a failure validates the step twice. Which is rather nasty 🥲