[BUG] Cannot submit form using return/enter key
Environment
Please provide as many details as you can:
- Hosting type
- [X] Local deployment v1.7.5.
Steps to Reproduce
- Create a form using react-formio
- Fill in the form. Press enter.
Expected behavior
Form should submit
Observed behavior
Form doesn't submit
I am unsure as to whether or not this is a bug or a feature request.
I have an additional question - is it possible to obtain a reference to formio.submit() from outside of the component? In order to implement this functionality in my wrapper component I have had to subclass the FormioForm class to obtain a reference to the internal formio instance.
I pass this subclass as the formioform prop into the react-formio Form component. With a reference to the internal instance, I then call formio.submit() when a return key is pressed. This is an awful hack that I wish I didn't have to do.
When you use the Form component, you can set a ref on it and get a reference to the formio react component. From there you should have access to formio.instance.submit or something like that. You can inspect the ref object and see where it is exactly. Once you have that, you can add a listener on the window and submit the form if enter is pressed. I don't think we have that by default but I can't remember the rationale for why.
I am closing the issue as it was created too long ago and there are no new comments here. I hope it was resolved. If not, please reopen it. Thanks!