TanStackT
TanStack2mo ago
6 replies
moderate-tomato

Always trigger onSubmit even when the form is invalid?

Hey there,

Is there a way to always trigger onSubmit even when the form is invalid. I kind of expected setting the canSubmitWhenInvalid argument would have this effect, but it only has an effect on the canSubmit flag.

I could just use the same function for onSubmitInvalid, but then I do have to manage some of the form state myself which is not ideal I would prefer to use the submission state variables.

The use case is a highly dynamic configuration based form and we don't differentiate between form actions all of them trigger a submit with an Id in the metadata. So in the case of save as draft when the user does not care if the form is valid or not we also want to trigger a submit which seems to be not possible currently.

Thanks in advance
Was this page helpful?