Skip to content
Discussion options

You must be logged in to vote

Hi 👋

isSubmitted only tells you that a submit attempt happened — it does not guarantee the form is valid.

If you want to know whether validation has run and control when to show error/success state, you can combine:

const { formState: { isSubmitted, isValid, errors } } = useForm({
mode: "onSubmit", // important
});

Key points:

isSubmitted → becomes true after submit attempt (even if invalid)

isValid → true only when there are no validation errors

errors → contains current validation errors

If your requirement is:

“Only show error/success state after validation”

You can do something like:

const showValidationState = isSubmitted;

{showValidationState && errors.name && Error}

Or for success …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by xsjcTony
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants