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:
This input type, when present, specifies that an input field must be filled out before submitting the form.
<input type="text" name="message" required>
This input type guarantees an email address is formatted correctly.
<input type="email" name="email">
This input type ensures a number with a range.
<input type="number" min="18" max="99" value="30" name="age">
This input type guarantees a URL is formatted correctly.
<input type="url" name="website">
With these attributes, you can limit the characters in a text input or textarea.
<input type="text" maxlength="10">
<textarea minlength="20"></textarea>