Skip to content

Prevent enter key from submitting #2549

Answered by ThinkSalat
ThinkSalat asked this question in Q&A
Discussion options

You must be logged in to vote

I removed onSubmit from the form element and removed the type="submit" from my button. I then used getValues({ nest: true }), formState: { isValid }, and triggerValidation() to handle what handleSubmit would have done.

Replies: 11 comments 22 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@pramade
Comment options

@alpha-nome
Comment options

Answer selected by ThinkSalat
Comment options

You must be logged in to vote
9 replies
@cdialpha
Comment options

@didoshakra
Comment options

@sahilahluwalia
Comment options

@MoonSangJin
Comment options

@HEVpro
Comment options

Comment options

You must be logged in to vote
6 replies
@burakharun
Comment options

@rpatel15-hue
Comment options

@ChristopherKubis
Comment options

@christocarr
Comment options

@I8Superman
Comment options

Comment options

You must be logged in to vote
3 replies
@maiaatala
Comment options

@HashRei
Comment options

@maiaatala
Comment options

Comment options

You must be logged in to vote
1 reply
@ravgeetdhillon
Comment options

Comment options

You must be logged in to vote
1 reply
@I8Superman
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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