modular-forms
modular-forms copied to clipboard
custom validation doesnt work on submit
I have a delivery form with a flat field and a noFlat checkbox. When the form is submitted, I need to check that if noFlat is not checked, then flat is required. I have a simple function to check this
const validateFlatRequired = (value: Maybe<FieldValue>): MaybePromise<boolean> => {
const noFlatValue = getValue(DeliveryFormStore, "noFlat")
if (!value) {
return noFlatValue === true
}
return true
}
but it only works on input (verified using console.log inside it). Is this expected behavior?
Can you provided a minimal reproduction via StackBlitz?
yeah, here's my code https://stackblitz.com/edit/github-k7kd32zi?file=src%2FApp.tsx The checkFlatFilled function call does not occur on submit