Free HTML form validation script

Create free web forms with HTML form validation scripts as easy as 1-2-3, using a simple HTML form validation script or the 123ContactForm web form builder.

HTML Form Validation Script
Do I need form validation?

If you want to receive only relevant and complete messages, then yes, – HTML form validation is a must! It helps you save time and reply to the important messages faster.

In this tutorial you'll see how you can check if users have entered valid information into a form. We will use a sample contact form and, to make it work properly, we will add Javascript Form Validation scripts.

What are the HTML form validation scripts

The HTML form validation script makes sure the data sent through the form is accurate and well formatted. Server side form validation, like 123ContactForm provides, works best.

You can use standard validation in your web form (like alpha, alphanumeric, numericplus, email, URL, date etc.), and you can create custom validations (like required fields, rejection of duplicate email value etc.).

Our HTML form validation scripts cover two areas:
  • Required fields that are left blank
  • Valid input format (email, URL, address, phone etc.)
HTML Form Validation Functionality

Creating a simple web form with HTML form validation scripts

Step 1: Create the HTML code of the form you want to validate
Firstly we will create the HTML form to which we will add the validation. For the purpose of this tutorial we will create a sample HTML contact form and we will validate:
  • Name field (validate for maximum length; check if input has been filled out)
  • E-mail field (validate for correct email format; validate field for maximum length)
  • Address field (validate for minimum and maximum lenght)
The HTML form without validation
  1. <form action="" method="POST" enctype="multipart/form-data">
  2. <input type="hidden" name="action" value="submit"/> Your name:<br />
  3. <input name="name" type="text" value="" size="30"/> <br /> Your email:<br />
  4. <input name="email" type="text" value="" size="30"/> <br /> Your message:<br />
  5. <textarea name="message" rows="7" cols="30"> </textarea> <br />
  6. <input type="submit" value="Send email"/>
  7. </form>

Step 2: Add the Javascript validation script
Now that we have the HTML contact form code ready, we will just add the Javascript that will process the data and then send a response to the user.

See it in action
Test the HTML form validation script on JS Bin or JSFiddle which are interactive code editors that show you the code in action.
Get more features by using our HTML form builder with built-in validation
You can now create any type of web forms using our drag & drop form builder, and add HTML form validation with the point-and-click ease. The generated HTML form validation script can be published on any website, blog and social platform: Wordpress, Facebook, Joomla, Wix, Blogger, Twitter, to start with. That's it! No coding. No headaches.

You can benefit of more input elements and features, like:
  • fields (single choices, multiple choices, textareas, dropdown lists) and
  • functionalities (Captcha image verification, advanced form validation)
Free HTML form builder with built-in validation
By signing up, you're agreeing with the 123ContactForm Terms of Service