Replies: 1 comment
-
You could just validate Similar to the Example here: https://tanstack.com/form/latest/docs/framework/react/examples/simple function FieldInfo({ field }: { field: AnyFieldApi }) {
return (
<>
{field.state.meta.isTouched && !field.state.meta.isValid ? (
<em>{field.state.meta.errors.join(',')}</em>
) : null}
{field.state.meta.isValidating ? 'Validating...' : null}
</>
)
} In your example it could look like this: error={state.meta.isBlurred ? state.meta.errors[0]?.message : undefined} What I like to do is add the error={(state.submissionAttempts > 0 || state.meta.isBlurred) ? state.meta.errors[0]?.message : undefined} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I essentially want to have this behaviour pictured in the video where you validate onBlur and then the onChange validates and if its successful we clear the error
However because onChange and onBlur errors are handled seperately the error cannot be cleared until onBlur triggers again.
Beta Was this translation helpful? Give feedback.
All reactions