Módulo 5 de 33 · Mídia
Validate a basic form
Create a simple validated form
Get yourself familiar with validating forms. For your next task you should create a form
within your HTML with the following fields and validates respectively:
1. Create a text input type field, for storing the name of the user. This should accept only strings between 4 and 20 characters. You may find useful the minLength and maxLength attributes here.
2. Create an input field of type password, to store the password of the user. This should be visually hashed (non-visible, only dots) and it should be at least 8 characters long.
3. Create an input field of type email, you don't have to do anything here. Validation comes automatically in case the user types something that doesn't seem like a valid email address.
4. Last put an input field of type number, that prompts the user to put it's age. The value of this field should be at least 18 and at most 70. May you want to find more about the min and max attributes here.
All fields should be required. That means they can't be omitted.
Try to submit the form, by putting at least one of the criteria wrong intentionally. What can you see? Which error comes first? Where does this error message come from?