Replies: 1 comment 1 reply
-
Hi! I think returning the validation result from As a workaround, you should be able to call const formRef = useRef<HTMLFormElement>(null);
const handleOnBlur = () => {
formElement.current.submit()
}
return (
<ValidatedForm formRef={formRef} validator={validator}>
<MyInput onBlur={handleOnBlur} />
</ValidatedForm>
); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to programatically post a form with a fetcher from useFetcher and have been running into some problems with form validations.
I want to post the form on the onBlur() event for the input control, and I don't know how the do the form validation since the form validation will also be triggered on the same onBlur() event.
I tired to do it like this, but the form.isValid will not be correct, I guess it gets updated in the next render?
It would be nice to get a return value from the form.validate() to understand if its valid or not.
Is it possible to do this in another way? I want to prevent the fetcher to post the form if the form is invalid.
Beta Was this translation helpful? Give feedback.
All reactions