Client-side validation of a form can be implemented in html.
It can also be implemented in javascript for more control.
!! Server-side validation is still necessary.
Specify required fields with the required attribute.
<input id="user_email" type="email" name="user_email" required>
minlength: specify the minimum amount of characters.maxlength: specify the maximum amount of characters.<textarea minlength="5" maxlength="20"></textarea>
min: minimum value.max: maximum value.<input type="number" min="1" max="5">
A regular expression can be used to validate fields.
Define it the pattern attribute.
To add a error message that inform the pattern to match to the user,
use the title attribute.
<input type="text" name="zip_code" pattern="(\d{5}([\-]\d{4})?)" title="Please enter a valid zip code, example: 53290">
In css, use the pseudo-class :valid and :invalid to style the element
based on its validation statue.