I'm adding some validation to a userName field on our sign up form to check if a username is available, and noticed that the field doesn't validate the same way that the email and password fields do, so users can submit the form in a bad state:
Form submitted with invalid username:
Submitting a 2nd time will show validation:
We just need to add autovalidateMode: AutovalidateMode.onUserInteraction to the metadata's TextFormField.
I'm adding some validation to a
userName
field on our sign up form to check if a username is available, and noticed that the field doesn't validate the same way that the email and password fields do, so users can submit the form in a bad state:Form submitted with invalid username: Submitting a 2nd time will show validation:
We just need to add
autovalidateMode: AutovalidateMode.onUserInteraction
to the metadata's TextFormField.