redux-form: Error in "Submit Validation" example, and a question
Hi,
I’m trying to get redux-form to work in my app, and as I’m working through your examples (bless you for those), i think I’ve found a bug. In this example:
http://erikras.github.io/redux-form/#/examples/submit-validation?_k=50jqgi
…you have this:
<form onSubmit={handleSubmit(submit)}>
…but then this:
<button type="submit" onClick={handleSubmit}>
I couldn’t get things to work until I ripped out the onClick
event from the submit button.
So first, the fact that those event handlers are different seems like a bug.
Second, is it necessary to have an onClick
handler on the submit button when you already have an onSubmit
handler on the form? Seems like the onSubmit
would be sufficient, unless there’s something I don’t understand about redux-form in general (which is entirely possible).
Thanks, and I hope this helps! Ben
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (6 by maintainers)
Commits related to this issue
- added faq and changed examples to reflect "submit on enter" knowledge from #399. — committed to redux-form/redux-form by erikras 8 years ago
I think you can avoid this by using
type="submit"
for the submit button andtype="button"
for others. That just worked in this jsfiddle in Chrome 48 http://jsfiddle.net/s9Ugr/601/See also http://stackoverflow.com/a/16462846/278891