Provide a set of callbacks to onSubmit method
See original GitHub issueProvide a set of callbacks to onSubmit method, for example reset
function
Are you submitting a bug report or a feature request?
feature request
What is the current behavior?
<Form
onSubmit={onSubmit}
initialValues={{ employed: true }}
render={({ handleSubmit, reset }) => (
<form
onSubmit={event => {
handleSubmit(event).then(() => {
reset() // or could be passed directly to then()
})
}}
>
...
</form>
}/>
What is the expected behavior?
const onSubmit = (values, reset) => {
return new Promise (resolve => {
reset();
resolve();
}
};
<Form
onSubmit={onSubmit}
initialValues={{ employed: true }}
render={({ handleSubmit, reset }) => (
<form onSubmit={handleSubmit}>
...
</form>
}/>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top Results From Across the Web
ReactJS: Form onSubmit failing to call callback - Stack Overflow
Passing this.onSubmit to the form's onSubmit callback prop causes the onSubmit() method that you've defined to be called, which in turn causes ...
Read more >How onsubmit Event work in JavaScript? Examples - eduCBA
The onsubmit event is performed the triggers is based upon the submit function whenever the client user request in the form-wise data is...
Read more >Callback functions - Vanilla Embed Library - Typeform's APIs
The onSubmit callback will execute immediately after a respondent successfully submits the typeform by clicking the "Submit" button.
Read more >How to perform jQuery Callback after submitting the form
First, the elements in a form must be ensured if it is loaded. · Then, the submit method is added a callback function....
Read more >HTMLFormElement: submit event - Web APIs | MDN
Use the event name in methods like addEventListener() , or set an event handler property. addEventListener('submit', (event) => {}) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh of course, yes, I mean that I’d put one together. Hopefully early next week!
Another way to do it is to wrap actual action in promise and send resolve/reject with it.
Then in saga you can call
yield call(resolve, ...)
or reject. So promises will be there and it will be possible to use.then(reset)
.