Open AlbertoV5 opened 1 year ago
It seems like this is the react-hook-form issue, I found this interesting article about resolving this kind of issue. Check this out! https://stackoverflow.com/a/69025391
All form fields are under:
<FormProvider>{}</FormProvider>
from import {FormProvider} from "react-hook-form"
https://react-hook-form.com/api/formprovider/
so I think submit method is available here:
useFormContext
https://react-hook-form.com/api/useformcontext/
Thank you! Will check that out :) For some reason the react hook form hooks give me a 404, these work: https://react-hook-form.com/docs/useformcontext
Question/Feature Request: Accessing the submitter element (button)
Hello. Sorry if this is specified on the docs or other issue, I wasn't able to find it by looking for 'submitter' or 'submit', etc. Is there a way to access the submitter element from the onSubmit function?. For example:
In the case of having multiple submit buttons for different actions with the same form state:
The current way to get the event data is to store outside of the form component
And then the parent component can use the submitter value:
It doesn't seem ideal, is the event available to the Form's parent element via any callback or form state? Can I modify the callback to include it? How could someone go about supporting multiple submit options? Haven't been able to find info. about it in the docs.
Thank you, very good library :)