Skip to content

Auto-submitting the form on blur? #2494

Answered by squiaios
piotr-sobczyk asked this question in Q&A
Discussion options

You must be logged in to vote

It would be more interesting to pass an onSubmit function to the formProvider and that this function be executed after the blur event of an input is triggerd (only if the validation is valid), or am I totally wrong?

Somethig like this :

const useFormProps = useForm({
        defaultValues: {url: ''},
        mode: 'onBlur',
        onSubmit: () => {
            console.log('function triggered after blur and validation valid')
        },
        resolver: joiResolver(Joi.object({
            url: Joi.string().uri({scheme: ['https']}),
        })),
    });

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@piotr-sobczyk
Comment options

@bluebill1049
Comment options

@piotr-sobczyk
Comment options

@pprob
Comment options

Comment options

You must be logged in to vote
5 replies
@bluebill1049
Comment options

@squiaios
Comment options

@younessdev9
Comment options

@Moshyfawn
Comment options

@nathanmlui
Comment options

Answer selected by bluebill1049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants