T
TanStack4mo ago
genetic-orange

`canSubmit` behavior, invalid form submission

From these docs:
The form state object has a canSubmit flag that is false when any field is invalid and the form has been touched (canSubmit is true until the form has been touched, even if some fields are "technically" invalid based on their onChange/onBlur props).
Is there a way to change that behavior? If not, what's the appropriate workaround for the "don't ever let 'technically' invalid forms be submitted" use case?
1 Reply
equal-jade
equal-jade4mo ago
since untouched fields are pristine, you could additionally check if the form is pristine and not allow submitting in that case

Did you find this page helpful?