Home page

Java Script Form Validation Ver. 1.1 


View Demo

  1. Introductione
  2. The project
  3. How it work
  4. Documentation (see right column)


The need to validate a lot of input fields made ​​me look around for network solutions such as Dojo, MooTools, Spry Framework and many other JavaScript. But all of these, except Spry Framework, does not provide adequate solutions to my requirements. For example a validation date fields with the format: 02-03-2008. In addition to the validation of input fields, it would be nice to also support the compilation of the fields. For example, when you enter a date format dd-mm-yyyy, but you input this pattern "1-3-4", the pattern should automatically turn it into "10/03/2004". This last feature was inspired by the build system of date fields in Microsoft Excel. Because many software projects requires filling out dates in forms, it is  necessary to simplify as much as possible the compilation of how users input data.


With Microsoft Excel is easy to insert more date value. Try to put in a cell following the date format string "1-3-4", is instantly formatted in the right way. 
Other aims of this project are:
Making the library easy to implement in existing projects, making the code less invasive as possible. In fact, to add the validation check just add a few more attributes to the TAG input:

< input type="text" check="date" format="dd-mm-yyyy" />
Evolvable: good documentation and good code;
Make it easy to modify the code to add new formats for input validation.
The project is released under GPL 2 and any form of cooperation for development is very welcome.
The algorithm to handle events and validation implements a Petri Net (see fig.) That models the common use of an input field.

How it work
At full load of the HTML page code, the browser calls "body.onload" event function, which coincides with the call to "init ()" function. This function parses all DOM and when it finds the tag INPUT with attribute CHECK, the program stops and adds to these fields an event.

< input type="text" check="date" format="dd-mm-yyyy" example="gg-mm-aaaa />


Example: try to insert in the date field only a number


Date :

Date :





Term of service
LOAD TIME: 0.021 s
Back Office