Closed braydenc303 closed 4 years ago
Also updated the placeholder and messages for the phone field.
SO close!
Thanks for changing the placeholder text in the phone number field, too.
The problem I am seeing is that it is validating the text, in both the email and phone fields, before the user exits the field.
To reproduce,
Actual: We see the error message, telling us the value of the field is not valid. Expected: As the user is typing in the field, there should be no error message. That should only appear once the user has left the field.
I have validation happening on blur now. I do not know how to accomplish the second bullet point:
either onBlur or onChange. The error message that is present upon the previous onBlur stays in place until the next onBlur where it is either valid, or has the same, or a different error message.
The only other option that I see here is to have validation onChange as is the default, that way, as soon as there is a valid value, or the field is cleared, the error message is cleared. Personally, this is the behavior that I prefer. That way, there is an error message present whenever the field is invalid, and it explains why the submit button is not active.
I am smiling ear to ear!
That's awesome, yes, I went through all the cases I could think of and there it is.. The code handles all of them. Nice.
I will merge this to the main Dev branch.
There are a few more polishes I can think of, and then we can merge it into Master.
Actually, now that I'm looking at it, only one polish: Remove the comments at the end of the file.
And the Cypress tests.
I updated issue #1 with a bit more detail about the steps to reproduce, and the expected vs actual behavior.