-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow programmatically submit #17
Comments
I also need this in order to be able to reset the form. |
@azzzy, have you tried using the Since we added |
@danielweinmann, this works nicely, somehow I missed it in the documentation. Thanks for the hint! |
@danielweinmann talking to @gustavoguichard we found a use case for this, when one wants to imperatively trigger the form submission (let's say when a verification code is typed). But instead of relaying the form ref we could expose a submit function for the form children function. Thoughts? |
We just found another use case for programmatically submitting the form: submit confirmation using a dialog. |
ref
to Form and forwarding it to component
I needed this ability myself. I have a complex component where it has a dialog modal that has it's own onClick methods and where the react-hook-form resides in it's body. There is no way to connect the forms handleSubmit and modal onClick methods. I have a really old version of remix-forms which I forked a while ago and not had the time to update it. Well, because it works so well. 😄 All I ended up doing was the following to the Form component for it to support a ref property:
Then the following to execute programmatically:
|
@diogob Although I took a look at the solution in #136 I am not quite sure. That said, once I have finished the current work that I am going through. I will be bringing up my fork of remix-forms to the latest and then I'll see where things stand. Maybe in a week or so, I'll then be able to comment here on any improvements or it's perfect for my use case. 😄. Many thanks for being reactive and making a PR so quickly for this amazing library. Looking forward to comes next in '23. 🚀 |
No description provided.
The text was updated successfully, but these errors were encountered: