HTML5 Form Validation

While we’re handling the form backends of your forms, you may want to validate
them before you publish to make sure your users enter the correct data. Even though
it is still not being supported in some browsers, HTML5 gives you a lot, from marking fields
as required, to size limits, to ensuring emails look like emails. Here are the most common validations:

Required Attribute

This input type guarantees an email address is formatted correctly.

<input type="text" name="message" required>

Email Attribute

This input type guarantees an email address is formatted correctly.

<input type="email" name="email">

Number Attribute

This input type ensures a number with a range.

<input type="number" min="18" max="99" value="30" name="age">

URL Attribute

This input type guarantees a URL is formatted correctly.

<input type="url" name="website">

Length Attributes

With these attributes, you can limit the characters in a text input or textarea.

<input type="text" maxlength="10">


<textarea minlength="20"></textarea>