/** * * Adds elements and rules to a pre-existing HTML_QuickForm object. * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $columns A sequential array of column names to use in * the form; if null, uses all columns. * * @param string $array_name By default, the form will use the names * of the columns as the names of the form elements. If you pass * $array_name, the column names will become keys in an array named * for this parameter. * * @return void * * @see HTML_QuickForm * * @see DB_Table_QuickForm * */ function addFormElements(&$form, $columns = null, $array_name = null, $clientValidate = null) { include_once 'DB/Table/QuickForm.php'; $coldefs = $this->_getFormColDefs($columns); DB_Table_QuickForm::addElements($form, $coldefs, $array_name); DB_Table_QuickForm::addRules($form, $coldefs, $array_name, $clientValidate); }
/** * * Build a form based on DB_Table column definitions. * * @static * * @access public * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @param array $args An associative array of optional arguments to * pass to the QuickForm object. The keys are... * * 'formName' : String, name of the form; defaults to the name of the * table. * * 'method' : String, form method; defaults to 'post'. * * 'action' : String, form action; defaults to * $_SERVER['REQUEST_URI']. * * 'target' : String, form target target; defaults to '_self' * * 'attributes' : Associative array, extra attributes for <form> * tag; the key is the attribute name and the value is attribute * value. * * 'trackSubmit' : Boolean, whether to track if the form was * submitted by adding a special hidden field * * @param string $clientValidate By default, validation will match * the 'qf_client' value from the column definition. However, * if you set $clientValidate to true or false, this will * override the value from the column definition. * * @param array $formFilters An array with filter function names or * callbacks that will be applied to all form elements. * * @return object HTML_QuickForm * * @see HTML_QuickForm * * @see DB_Table_QuickForm::createForm() * */ function &getForm($cols, $arrayName = null, $args = array(), $clientValidate = null, $formFilters = null) { $form =& DB_Table_QuickForm::createForm($args); DB_Table_QuickForm::addElements($form, $cols, $arrayName); DB_Table_QuickForm::addRules($form, $cols, $arrayName, $clientValidate); DB_Table_QuickForm::addFilters($form, $cols, $arrayName, $formFilters); return $form; }