/** * @Author: Albert Harounian * @desc: Global form elements validation * @since: August 16 2007 * @usage: validate( * frmName [required], * errorClass [optional], * breakByAlert [optional] * ); * frmName = form NAME(NOT ID!) to be validate * errorClass = class name to be ADDED to element when the value is not valid * breakByAlert = if sets to true function WILL return error string for current element, then makes alert and exits * *************************************************************************************************************************** * SYNTAX: * required="REQUIRED TPYE:FIELD NAME:ERROR MSG;EXTRA PARAMS" * * REQUIRED TPYE = any|email|numeric|hebrew|english|price|password|filee for the same input name * FIELD NAME = field name that present to user on error; * ERROR MSG = your msg when the field doesnt match the required type [optional] * EXTRA PARAMS = ALLOWED extensions file for file inputs ( divider line seperated ) or * MINIMUM CHARS and/or COMPARISON to another input(by NAME) for PASSWORD inputs ( COMMA seperated ) * *************************************************************************************************************************** * *************************************************************************************************************************** * NOTES: this validation function use 'REQUIRED' attribute for checking the field. * (!) REQUIRED TPYE CAN be ANYTHING if the input type is NOT TEXT type but it CAN NOT be NULL * (!) REQUIRED TPYE CAN be NULL if it defined before (usually for radio buttons and checkboxes) * * (!) FIELD NAME can be NULL or ANYTHING - its up to you * (!) If FIELD NAME is empty the REAL(from 'name' attribute) will present to user * * (!) if ERROR MSG is NOT defined, the function will return messages form variables BELOW instead * * (!) when EXTRA PARAMS used for PASSWORD inputs, values(minimum length and/or comparison input name) * should be seperates by COMMA * *************************************************************************************************************************** * e.g * e.g * e.g * e.g * e.g * e.g * e.g (!) No need to define REQUIRED attribute * e.g */