---
title: How to validate your form with HTML5
date: '2021-06-30T18:02:22+00:00'
url: https://support.formkeep.com/how-to-validate-your-form-with-html5/
summary: |-
  Some forms require validations to ensure that users enter the correct data. While FormKeep does have some  server-side validation using our Field Rules to detect spam, you can validate your form client-side with either HTML5 or JavaScript.

  The benefit of HTML5 validations is that they take minimal effort to implement. You add a few attributes to your markup and you’re good to go. The downside is that it is still unsupported in some browsers. Depending on your needs, a lightweight solution like this may be enough.

  HTML5 gives you a lot, from marking fields as required, to size limits, to ensuring emails look like emails. Here’s a taste:

  &lt;input name="name" type="text" required&gt;

  Mark a field as required with the required attribute:

  &lt;input type="email" name="email"&gt;

  Ensure an email address is formatted correctly

  &lt;input name="email" type="url"&gt;

  Ensure a URL is formatted correctly

  &lt;input name="age" type="number" min="18" max="99" value="21"&gt;

  Ensure a number is with a range

  &lt;textarea name="bio" minlength="50" maxlength="300"&gt;&lt;/textarea&gt;

  You can also limit the characters in a text input or textarea

  &lt;input type="text" name="email" placeholder="work email" pattern="^((?!(gmail.com|hotmail.com|yahoo.com)).)*$" title="Work email addresses only"&gt;

  Maybe you want to not allow certain email service providers. This will not allow gmail.com, hotmail.com or yahoo.com email addresses from being entered.
tags:
- Settings
- Features
author: Support Team
---

# How to validate your form with HTML5

Some forms require validations to ensure that users enter the correct data. While FormKeep does have some  server-side validation using our Field Rules to detect spam, you can validate your form client-side with either HTML5 or JavaScript.

The benefit of HTML5 validations is that they take minimal effort to implement. You add a few attributes to your markup and you're good to go. The downside is that it is still [unsupported in some browsers](https://caniuse.com/form-validation). Depending on your needs, a lightweight solution like this may be enough.

HTML5 gives you a lot, from marking fields as required, to size limits, to ensuring emails look like emails. Here's a taste:

~~~html
<input name="name" type="text" required>
~~~
Mark a field as required with the **required** attribute:

~~~html
<input type="email" name="email">
~~~
Ensure an email address is formatted correctly

~~~html
<input name="email" type="url">
~~~
Ensure a URL is formatted correctly

~~~html
<input name="age" type="number" min="18" max="99" value="21">
~~~
Ensure a number is with a range

~~~html
<textarea name="bio" minlength="50" maxlength="300"></textarea>
~~~
You can also limit the characters in a text input or textarea

~~~html
<input type="text" name="email" placeholder="work email" pattern="^((?!(gmail.com|hotmail.com|yahoo.com)).)*$" title="Work email addresses only">
~~~
Maybe you want to not allow certain email service providers. This will not allow gmail.com, hotmail.com or yahoo.com email addresses from being entered.
