gerhat / material-ui-formik-components

Formik ready material ui components
MIT License
85 stars 13 forks source link

Form doesn't submit/validate if fields are untouched #4

Closed plnichols closed 5 years ago

plnichols commented 5 years ago

Hi, I noticed that in your example RegistrationForm.jsx, if you don't touch/type anything in the form and try to submit, nothing happens.

There's no feedback at all to the user.

Then if you type 1 character in any field, the whole form gets validated with all fields in red (error).

Maybe that's expected behaviour, but giving no feedback at all to the user doesn't seem to be the best way to go. Is there a way to trigger the form validation even if the form was not touched?

gerhat commented 5 years ago

Hi @plnichols. This is the intended behaviour. The reasoning behind it is: "Why show any errors if the nothing is changed in the form".

A workaround for now would be to have the submit button disabled while the form is not dirty. See updated example: https://github.com/gerhat/material-ui-formik-components/blob/master/example/src/RegistrationForm.jsx

pzapo commented 3 years ago

Example url is 404.

gerhat commented 3 years ago

Changed the name of the example. New url is this: https://github.com/gerhat/material-ui-formik-components/blob/master/example/src/SimpleFormExample.jsx