Author : Sina Salek (http://sina.salek.ws)
Website : http://combovalidation.sourceforge.net
Version : 1.0
This class is meant to validate HTML forms via PHP and also JavaScript in the simplest possible way. all you need to do is to create an array of form fields information with require parameters and then call few methods.
Notice : As i mentioned before, this class works pretty fine in most of the circumstances unless you define a wrong array. Unfortunately there is no validation for the options you pass to the class so when you set a wrong parameter, all you see is a wrong behavior. Therefore, please check the array structure with the bundled working examples and also this manual and make sure that you defined it correctly. and if the problem still remains then report it as bug.
Notice : This document currently only covers the basic features of this class, for the advanced features such as defining a new field type, customizing error display and validation functions check out bounded examples , inside "examples" folder.
Main features :
* Customizable
o Validation : (defining new field types, overriding validation functions , using regex , etc...)
o View : ability to choose between various ways of showing errors. currently "alert,div , nearFields, pageCenterDiv, formCenterDiv ,customizedDiv" are supported out of the box. and it's also possible to override the display function and show errors in the way you want.
* Cross browser (IE6+, Firefox2+, Opera7+, Safari3+, All Mozilla based browsers)
* Very well tested. More than 30 projects are currently using it
* Easily integrate able , All of the PHP functions used in the class have prefix and also accepts prefix for JavaScript for preventing conflict with other JavaScript in the application
* Ajax support : No official Ajax support at the moment but since you can completely overwrite the built in validation functions and error display functions you can do the validation with your own Ajax framework
* Light weight : Because it does not use any JavaScript framework.
* Extensible : Some design patterns like factory and chain of commands have been used in both JavaScript and PHP sides for ease of extensibility. Code is documented and also name of all of the methods and functions are self described.
* PHP 4 & 5 compatible
* Multilingual
* XHML Valid
To-do :
* Better error reporting for class methods and options
* Validation for fields info and parameters
* Making it Jquery compatible (optional)
* Validation should work with multiply forms in one page (by adding formName item to each fieldInfo)
* Single JavaScript class in web page with multiply instance, validation instances should be connected
* Special methods for ease of validation via Ajax
* Support three type of messages , warning , information , error
* Compress JavaScript's
Change log :
rev12@2008-06-28 (First official release),
* in Firefox when form defines in non w3c way, Firefox can't find the fields inside it. it should throw an error
* getElementsByName() issue with multiRadioBoxes and multiCheckBoxes solved
* supporting for new type "array"
* optimizing getFormFieldObject() for large forms
* if formName does not define, it will for the fields in the whole document
* support finding the field value via only field name without pattern name
* tested with PHP 4.x and PHP 5.2.x
* completely tested with IE 6.x,7.x , Firefox 2.x , Opera 9.x , Safari 3.x
* Ajax support via completely overriding object display or validation function
* custom field type
* customizing error messages
* override display function
* custom new display modes
* overriding or extending validation functions (validate, validateAfter, validateBefore)
* limited custom validation for fields which have need regular validations like notEmpty and also some more
* chain of commands pattern support for JavaScript and PHP
* validate fields with regular expression (JavaScript & PHP) |