Replies: 2 comments 1 reply
-
Why can't you just add onClick={onSubmit} to the button in the dialog? Like you could do form.trigger() to trigger/check for errors, then if there aren't any errors you do onSubmit. onClick={() => {
form.trigger()
if (form.formState.isValid) onSubmit()
}} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Shadcn has a bug, if you add an AlertDialog inside a form, the action does not propagate submit |
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
-
I've been having trouble attempting to use the Shadcn react-hook form wrapper with a dialog hook. the behavior im trying to implement is to trigger the onSubmit (or any action, such as passing data back to the parent component) from the button in the dialog.
ive found a couple of articles like this, but none of these approaches seem to work.
https://bdaneesha.medium.com/react-submit-form-using-button-in-parent-component-ii-d58c43abcfc8
any ideas?
Beta Was this translation helpful? Give feedback.
All reactions