* @author Bertrand Mansion
* @author Alexey Borzov
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: QuickForm.php,v 1.166 2009/04/04 21:34:02 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Validation rules known to HTML_QuickForm
* @see HTML_QuickForm::registerRule(), HTML_QuickForm::getRegisteredRules(),
* HTML_QuickForm::isRuleRegistered()
* @global array $GLOBALS['_HTML_QuickForm_registered_rules']
*/
/**
* Error codes for HTML_QuickForm
*
* Codes are mapped to textual messages by errorMessage() method, if you add a
* new code be sure to add a new message for it to errorMessage()
*
* @see HTML_QuickForm::errorMessage()
*/
define('QUICKFORM_OK', 1);
define('QUICKFORM_ERROR', -1);
define('QUICKFORM_INVALID_RULE', -2);
define('QUICKFORM_NONEXIST_ELEMENT', -3);
define('QUICKFORM_INVALID_FILTER', -4);
define('QUICKFORM_UNREGISTERED_ELEMENT', -5);
define('QUICKFORM_INVALID_ELEMENT_NAME', -6);
define('QUICKFORM_INVALID_PROCESS', -7);
define('QUICKFORM_DEPRECATED', -8);
define('QUICKFORM_INVALID_DATASOURCE', -9);
/**
* Class HTML_QuickForm
* Create, validate and process HTML forms
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel
* @author Bertrand Mansion
* @author Alexey Borzov
* @version Release: 3.2.11
*/
class HTML_QuickForm extends HTML_Common
{
const MAX_ELEMENT_ARGUMENT = 10;
private $dateTimePickerLibraryAdded;
/**
* Array containing the form fields
* @since 1.0
* @var array
* @access private
*/
public $_elements = array();
/**
* Array containing element name to index map
* @since 1.1
* @var array
* @access private
*/
public $_elementIndex = array();
/**
* Array containing indexes of duplicate elements
* @since 2.10
* @var array
* @access private
*/
public $_duplicateIndex = array();
/**
* Array containing required field IDs
* @since 1.0
* @var array
* @access private
*/
public $_required = array();
/**
* Prefix message in javascript alert if error
* @since 1.0
* @var string
* @access public
*/
public $_jsPrefix = 'Invalid information entered.';
/**
* Postfix message in javascript alert if error
* @since 1.0
* @var string
* @access public
*/
public $_jsPostfix = 'Please correct these fields.';
/**
* Datasource object implementing the informal
* datasource protocol
* @since 3.3
* @var object
* @access private
*/
public $_datasource;
/**
* Array of default form values
* @since 2.0
* @var array
* @access private
*/
public $_defaultValues = array();
/**
* Array of constant form values
* @since 2.0
* @var array
* @access private
*/
public $_constantValues = array();
/**
* Array of submitted form values
* @since 1.0
* @var array
* @access private
*/
public $_submitValues = array();
/**
* Array of submitted form files
* @since 1.0
* @var integer
* @access public
*/
public $_submitFiles = array();
/**
* Value for maxfilesize hidden element if form contains file input
* @since 1.0
* @var integer
* @access public
*/
public $_maxFileSize = 1048576; // 1 Mb = 1048576
/**
* Flag to know if all fields are frozen
* @since 1.0
* @var boolean
* @access private
*/
public $_freezeAll = false;
/**
* Array containing the form rules
* @since 1.0
* @var array
* @access private
*/
public $_rules = array();
/**
* Form rules, global variety
* @var array
* @access private
*/
public $_formRules = array();
/**
* Array containing the validation errors
* @since 1.0
* @var array
* @access private
*/
public $_errors = array();
/**
* Note for required fields in the form
* @var string
* @since 1.0
* @access private
*/
public $_requiredNote = '* denotes required field';
/**
* Whether the form was submitted
* @var boolean
* @access private
*/
public $_flagSubmitted = false;
/**
* Class constructor
* @param string $formName Form's name.
* @param string $method (optional)Form's method defaults to 'POST'
* @param string $action (optional)Form's action
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for