Skip to content
Discussion options

You must be logged in to vote

Hello, I had the same issue with radix and RHF. Even tho the child components, which also contained forms themselves themselves, were rendered in portals outside the parent form, they were somehow still treated as nested forms. Since the submit event bubbles up, the parent form's submit handler was also called when the child forms were submitted. I worked around the issue by stopping propagation of the submit events in the children like so:

InsertImageDialog example:

<form onSubmit={(event) => {
      event?.stopPropagation();
      form.handleSubmit(onSubmit)(event);
  }}>
  ....
</form>

Cheers

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by KhatriFaiz
Comment options

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

@maurer2
Comment options

@EWisselink
Comment options

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