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.
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:
We recommend using HTML5's built-in validation. It is very rich these days and has good browser support.
Required Attribute
This input type, when present, specifies that an input field must be filled out before submitting the form.
<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 text area.