Closed kaw2k closed 7 years ago
I agree with your assessment and think it's more idiomatic to how HTML forms are implemented according to spec. By default forms won't submit unless the form is valid. The attribute name to bypass this behavior is novalidate
in HTML.
I agree @samuelmaddock. I changed the default to not calling onSubmit
if the form is invalid. If noValidate
is present, onSubmit
will be called regardless. In both situations, validation
is passed to onSubmit
.
So it is debatable if
onSubmit
should be called with an invalid form. 90% of the time you can just have the default form validation take care of showing errors. In that case, it is just a distraction to callonSubmit
with bad form data.This PR adds a prop to change how this works. Setting this prop to
false
will cause the form not to callonSubmit
with bad form data.Thoughts on prop name / other thoughts?