Replies: 2 comments
-
FWIW, even if I remove the This also still happens if I replace the shadcn UI |
Beta Was this translation helpful? Give feedback.
0 replies
-
Looks like explicitly marking the reset button as type='button' solves this <Button variant='outline' type='button' onClick={resetForm}>
Reset filters
</Button> |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Sheet component that contains a Form and two Buttons: one is of
type='submit'
to submit the form and one simply contains anonClick
handler to reset the form, but keep the Sheet open. However, the reset button also triggers theonSubmit
handler, in addition to theonClick
handler.Here's where they're used:
Is this a problem with my implementation? How can I tell in the
onSubmit
handler what triggered it, so I can ignore some cases? I've looked at the event data passed as the second argument to that handler, but it didn't seem to contain distinguishing details.I used the shadcn UI form documentation as a basis for this.
The page in its entirety:
Beta Was this translation helpful? Give feedback.
All reactions