Wizard - Set initial state for all steps #1335
-
Just wondered if it's possible for the initial state for all Wizard steps to be set on form render? I was hoping this would be possible using Code Sandbox example can be viewed here: Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@edhollinghurst Hi. Yes, it is very much possible. You have to use the You can check this example, which is just a fork of yours: https://codesandbox.io/s/react-form-renderer-wizard-forked-o0hr15 |
Beta Was this translation helpful? Give feedback.
@edhollinghurst Hi. Yes, it is very much possible. You have to use the
initialValues
prop on the form renderer to set initial values globally. The initial value used in a schema field will only appear in the form state once the field is registered to the form for the first time.You can check this example, which is just a fork of yours: https://codesandbox.io/s/react-form-renderer-wizard-forked-o0hr15
The only change I made is taking the initialValues from your fields in the schema and passing them as a prop to the renderer.