I just wanted to share a piece of open source code for everybody. Introducing, Live Validation.com, the most well-built open source form validation code I have ever come across.


Pros:


- The validation is on-the-fly and onClick. Meaning, that it validates during user input plus when the user hits submit.

- The validation displays up to 4 types of on-the-fly validation: it validates if the user has not input anything into a required field, if the inputted data is too short or too long, if the inputted data is correct, and if the inputted data is an invalid entry, such as e-mail addresses.

-The JavaScript file, ONE file, is object-oriented, fully commented, and easy to use or edit. You may edit any strings such as the string that outputs to the user and it’s very easy to find within the code. Best of all, unlike other validation scripts, each field you want to validate only requires 2 lines of code that I promise should not interfere with anything else your form has going on for it. It uses your input field name to initialize it as an object and then you specify what type of validation you’d like it to check for. EASY.

-The developers have tried to make it very easy for Ruby on Rails integration but also have a regular version available to download.

- It has many types of validation, such as: you may validate if any entry has been inputted into a required field, a field may not have to be required and you may still run validation such as for an email address, you may check the minimum or maximum or range of characters entered, etc. This makes it very flexible. Also, you may even only ask it to validate onSubmit only, so you have many choices for a very flexible form.

- The JavaScript outputs the strings to the user in CSS classes, so you may fully design it.

- I tested this on many browsers and it seems to work 100% of the time on IE6, IE7, Mozilla, Firefox, Opera, Safari, both on Mac and PC systems.


Cons:


- Like with any JavaScript, you have to determine how to design the form around people with JavaScript turned off or the impaired.

- Make sure to still use server-side scripting as a backup validation.

    Happy validating!

    By Louisa Nicholson

    Letters to the Editor












     

    Editor

    Copyright 2008
    Louisa Nicholson