cvs: pear /DB_Table/DB/Table QuickForm.php

From: Date: Wed, 27 Oct 2004 21:17:26 +0000
Subject: cvs: pear /DB_Table/DB/Table QuickForm.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25309@lists.php.net to get a copy of this message
pmjones Wed Oct 27 17:17:26 2004 EDT Modified files: /pear/DB_Table/DB/Table QuickForm.php Log: added createForm() method from Ian Eure http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/QuickForm.php?r1=1.11&r2=1.12&ty=u Index: pear/DB_Table/DB/Table/QuickForm.php diff -u pear/DB_Table/DB/Table/QuickForm.php:1.11 pear/DB_Table/DB/Table/QuickForm.php:1.12 --- pear/DB_Table/DB/Table/QuickForm.php:1.11 Mon Jul 12 11:14:22 2004 +++ pear/DB_Table/DB/Table/QuickForm.php Wed Oct 27 17:17:25 2004 @@ -22,7 +22,7 @@ * DB_Table_QuickForm provides HTML form creation facilities based on * DB_Table column definitions transformed into HTML_QuickForm elements. * -* $Id: QuickForm.php,v 1.11 2004/07/12 15:14:22 pmjones Exp $ +* $Id: QuickForm.php,v 1.12 2004/10/27 21:17:25 pmjones Exp $ * * @author Paul M. Jones <pmjones@ciaweb.net> * @@ -32,6 +32,7 @@ class DB_Table_QuickForm { + /** * * Build a form based on DB_Table column definitions. @@ -76,12 +77,61 @@ * @return object HTML_QuickForm * * @see HTML_QuickForm + * + * @see DB_Table_QuickForm::createForm() * */ function &getForm($cols, $arrayName = null, $args = array(), $clientValidate = null) { + $form =& DB_Table_QuickForm::createForm($args); + DB_Table_QuickForm::addElements($form, $cols, $arrayName); + DB_Table_QuickForm::addRules($form, $cols, $arrayName, $clientValidate); + + return $form; + } + + + /** + * + * Creates an empty form object. + * + * In case you want more control over your form, you can call this function + * to create it, then add whatever elements you want. + * + * @static + * + * @access public + * + * @author Ian Eure <ieure@php.net> + * + * @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 + * + * @return object HTML_QuickForm + * + */ + + function &createForm($args = array(), $clientValidate = null) + { $formName = isset($args['formName']) ? $args['formName'] : $this->table; @@ -102,9 +152,6 @@ $form =& new HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit); - - DB_Table_QuickForm::addElements($form, $cols, $arrayName); - DB_Table_QuickForm::addRules($form, $cols, $arrayName, $clientValidate); return $form; }

« previous php.pear.cvs (#25309) next »