Hi, I've added the validation function on useForm.
Then I passed the form into a component, and I have there the <form onSubmit={form.onSubmit(handleSubmit, handleErrors)} /> tag.
If I click on Validate button, it shows the red buttons, but If I click the button that submits the form, I don't get the errors in red but a popup saying required field.
So form.validate() does show the erros as expected.
form.onSubmit(handleSubmit) does not. (It shows the default popup)
My form:
const productForm = useForm<CreateUpdateProductDTO>({
initialValues: {...product, price: product.basePrice, categoryId: product.category.id },
validate: {
name: (value) => (!value ? 'Mandatório' : null),
price: (value) => (!value ? 'Obrigatório' : null),
taxId: (value) => (!value ? true : null),
sku: (value) => (!value ? true : null),
status: (value) => (!value ? true : null),
}
});
Any idea? :/