Also, the attribute can be added to form controls, to programmatically indicate that they are required.Most current web browsers support this attribute and will communicate missing required input to the user, using standard web browser dialog mechanisms.
If your web browser supports HTML5, it will not allow you to submit the form without entering text into the input field.
Instead, it will display a message that is generated by the web browser itself.
Validation controls are used to: Implement presentation logic. Data format, data type and data range is used for validation.
Validation is of two types: Client Side Serve Side Client side validation is good but we have to be dependent on browser and scripting language support.
These dialogs are expected to respect the settings and preferences of the user in the web browser (and operating system), such as default font-size, colors, and language.
In the example below, the attribute is added to the input field.
For example, telephone numbers are written with different separators and digit groupings.
Your form will be easier to use if it can interpret multiple notations. For example, postal codes aren't confined to just numbers in some countries, so using an can easily become a problem for many of your website users.
HTML5 input types are displayed as simple input fields in older web browsers that do not support these HTML5 features.
The example below shows these HTML5 input types in action.
The required pattern consists of one to three letters (for the city where the car is registered), followed by a space, two to four random letters, another space, then one to four random numbers.