Html code for validating forms
If the field contains an invalid value, the form cannot be submitted for processing until it is corrected.
Try the demo below by entering an invalid email: See the Pen Email Validation Example by Site Point (@Site Point) on Code Pen.
As a result, the specification doesn’t define an algorithm for validating these, hence it isn’t supported web browsers at the time of writing. The pattern attribute will likely make a lot of developers, especially those working on the front-end, happy.For example, in an email form field, instead of entering a valid email address, the user might enter an invalid one or malicious data obviously ignoring the intent of the request.When it comes to validating form values, it can be done on the client-side (web browser) and on the server-side (using your preferred server-side language).HTML5 includes a fairly solid form validation mechanism powered by the following .Thanks to these new attributes in HTML5, you can delegate some data verification functions to the browser.