Replies: 1 comment
-
|
You don't need a Your field is <form.Field
name="step1.name"
validators={{
onChange: ({ value }) => someCustomValidationLogic(value),
}}
children={(field) => (
<input
value={field.state.value}
onChange={(e) => field.handleChange(e.target.value)}
/>
)}
/>Once the name is Keep the group-level For the dynamic-wizard case, this scales fine since each step is just its own group name and the fields under it carry their own validators. The order you render the steps in doesn't change any of that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am playing around with the new
FormGroupfeature as per https://tanstack.com/form/latest/docs/framework/react/guides/form-groups. In my wizard, I want to have a "Next Step" button which is only enabled if the form is valid (sotrueby default when entering the wizard, but disabling as soon as you make some invalid/ incorrect input)Say I have a snippet similar to the example code:
How do I make my
step1.namefield "understand" that it is now part of the outerFormGroup, so thatgroup.state.meta.isFieldsValidgets passed to the button correctly? It seems that despite the documentation says......there is actually no
group.Fieldthat I can use to explicitly add a field as "you are part of this group now".Do I have to hoist up all of my validation logic into the
FormGroupsonChangevalidation return object, when the custom logic was previously living inside all of the (many, many) nested fields? I have found that sub-fields are magically able to detect that they have an error when you return the correct key under aFormGroupsonChangereturn value'sfieldskey, but epecially with dynamic wizards (where the order of the steps might be up to user configuration) I am not sure whether squeezing all validation logic into theFormGroupthat was previously residing separately in the individualform.Fieldsis desirable or even possible.Any kind of advice would be appreciated! Thank you in advance :)
Beta Was this translation helpful? Give feedback.
All reactions