How to implement tanstack submit button outside a form #1454
-
Currently I'm using material ui where in a dialog, there's a tanstack form component, wrapping with useAppForm. In the dialog footer, it contains the buttons that's outside of the form.I write creating a button submit or expose the form to the component, the handleSubmit is not called. Is there a way to get around with this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Could you share some example code? |
Beta Was this translation helpful? Give feedback.
-
I agree with @CanRau that example code could help, but this may be the solution to your case: If a Does your code allow this structure, or are there still questions? |
Beta Was this translation helpful? Give feedback.
I agree with @CanRau that example code could help, but this may be the solution to your case:
If a
<button type="submit">
is not within a<form>
, then it will not trigger itsonSubmit
event. Instead, you can simply passonClick={form.handleSubmit}
to the button directly.Does your code allow this structure, or are there still questions?