How to validate your form with HTML5

Some forms require validations to ensure that users enter the correct data. While FormKeep does not offer server-side validation, 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:

Mark a field as `required` with the `required` attribute:

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

Ensure an email address is formatted correctly:

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

Ensure a URL is formatted correctly:

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

Ensure a number is with a range:

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

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

<textarea name="bio" minlength="50" maxlength="300"></textarea>

That's it! Why not get started now?

Looking for something else?

Email us @formkeep