In addition to providing instructions, validate user input to help users avoid mistakes.
Client-side validation alone does not ensure security; therefore data needs to be validated on the server-side as well.
Forms frequently include required input that needs to be clearly identified using labels.
In addition, 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.
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.
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.
Note that the label also displays “(required)”, to inform users that don’t use assistive technology or use older web browsers that do not support the HTML5 attribute informs assistive technologies about required controls so that they are appropriately announced to the users (as opposed to validating the input).
Most current web browsers automatically set its value to .
Most current web browsers support these features and handle input validation.