Rules for User Input Categories

In this lesson, let's choose which rules will be used to validate various user input types such as birthday, name and username.

What is the goal of adding auto validation to forms? #

When forms validate inputs for users before they hit submit, it’s to prevent frustration when they later hit submit with improper inputs and are rejected. The second worst user experience you can provide is to wait until the user has filled out all the information and hits submit, only to be rejected for an unclear reason and forced to re-enter information- I’ll get to the worst in a second.

Therefore, let’s only validate when the user appears to be finished with that input.

There are some exceptions to this rule, and that’s where the requirements are ambiguous. Everyone knows what emails are supposed to look like, but different websites can have different requirements for passwords depending on their audience, risk of security breaches (it’s not the end of the world if someone gains access to your yoga membership account, ​but it could be disastrous if they do gain access to your bank account). It’s reasonable to show the requirements of inputs with varying rules before the user enters them – or better yet, as the user enters them:

Get hands-on with 1200+ tech skills courses.