cvs: pear /HTML_QuickForm QuickForm.php package.xml /HTML_QuickForm/Elements button.php checkbox.php date.php file.php group.php hidden.php image.php
input.php password.php radio.php reset.php select.php submit.php text.php textarea.php /HTML_QuickForm/docs QuickForm_example.php
| From: | Bertrand Mansion | Date: | Mon, 05 Nov 2001 17:06:03 +0000 |
| Subject: | cvs: pear /HTML_QuickForm QuickForm.php package.xml /HTML_QuickForm/Elements button.php checkbox.php date.php file.php group.php hidden.php image.php input.php password.php radio.php reset.php select.php submit.php text.php textarea.php /HTML_QuickForm/docs QuickForm_example.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1263@lists.php.net to get a copy of this message | ||
mansion Mon Nov 5 12:06:03 2001 EDT
Added files:
/pear/HTML_QuickForm package.xml
Modified files:
/pear/HTML_QuickForm QuickForm.php
/pear/HTML_QuickForm/Elements button.php checkbox.php date.php
file.php group.php hidden.php
image.php input.php password.php
radio.php reset.php select.php
submit.php text.php textarea.php
/pear/HTML_QuickForm/docs QuickForm_example.php
Log:
Fixes paths: Installation has to be done in HTML/QuickForm directory.
Some cleanup and package.xml commit.
Index: pear/HTML_QuickForm/QuickForm.php diff -u pear/HTML_QuickForm/QuickForm.php:1.3 pear/HTML_QuickForm/QuickForm.php:1.4 --- pear/HTML_QuickForm/QuickForm.php:1.3 Tue Oct 16 09:25:27 2001 +++ pear/HTML_QuickForm/QuickForm.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,11 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: QuickForm.php,v 1.3 2001/10/16 13:25:27 mansion Exp $ +// $Id: QuickForm.php,v 1.4 2001/11/05 17:06:02 mansion Exp $ + require_once("PEAR.php"); require_once("HTML/Common.php"); + /** * Create, validate and process HTML forms * @@ -29,6 +31,7 @@ * @since PHP 4.0.3pl1 */ class HTML_QuickForm extends HTML_Common { + /** * Array containing the form fields * @since 1.0 @@ -36,6 +39,7 @@ * @access private */ var $_elements = array(); + /** * Array containing required field IDs * @since 1.0 @@ -67,6 +71,7 @@ * @access public */ var $_jsPostfix = "Please correct these fields."; + /** * Array of form values * @since 1.0 @@ -90,6 +95,7 @@ * @access public */ var $_submitFiles = array(); + /** * Value for maxfilesize hidden element if form contains file input * @since 1.0 @@ -104,6 +110,7 @@ * @access private */ var $_hidden = array(); + /** * Array containing the frozen fields * @since 1.0 @@ -119,6 +126,7 @@ * @access private */ var $_freezeAll = false; + /** * Array containing the form rules * @since 1.0 @@ -126,6 +134,7 @@ * @access private */ var $_rules = array(); + /** * Array containing the validation errors * @since 1.0 @@ -133,6 +142,7 @@ * @access private */ var $_errors = array(); + /** * Note for required fields in the form * @var string @@ -149,20 +159,21 @@ */ var $_registeredTypes = array( - 'group' =>array('HTML_QuickForm/Elements/group.php','HTML_QuickForm_group'), - 'hidden' =>array('HTML_QuickForm/Elements/hidden.php','HTML_QuickForm_hidden'), - 'reset' =>array('HTML_QuickForm/Elements/reset.php','HTML_QuickForm_reset'), - 'checkbox' =>array('HTML_QuickForm/Elements/checkbox.php','HTML_QuickForm_checkbox'), - 'file' =>array('HTML_QuickForm/Elements/file.php','HTML_QuickForm_file'), - 'image' =>array('HTML_QuickForm/Elements/image.php','HTML_QuickForm_image'), - 'password' =>array('HTML_QuickForm/Elements/password.php','HTML_QuickForm_password'), - 'radio' =>array('HTML_QuickForm/Elements/radio.php','HTML_QuickForm_radio'), - 'button' =>array('HTML_QuickForm/Elements/button.php','HTML_QuickForm_button'), - 'submit' =>array('HTML_QuickForm/Elements/submit.php','HTML_QuickForm_submit'), - 'select' =>array('HTML_QuickForm/Elements/select.php','HTML_QuickForm_select'), - 'text' =>array('HTML_QuickForm/Elements/text.php','HTML_QuickForm_text'), - 'textarea' =>array('HTML_QuickForm/Elements/textarea.php','HTML_QuickForm_textarea') + 'group' =>array('HTML/QuickForm/Elements/group.php','HTML_QuickForm_group'), + 'hidden' =>array('HTML/QuickForm/Elements/hidden.php','HTML_QuickForm_hidden'), + 'reset' =>array('HTML/QuickForm/Elements/reset.php','HTML_QuickForm_reset'), + 'checkbox' =>array('HTML/QuickForm/Elements/checkbox.php','HTML_QuickForm_checkbox'), + 'file' =>array('HTML/QuickForm/Elements/file.php','HTML_QuickForm_file'), + 'image' =>array('HTML/QuickForm/Elements/image.php','HTML_QuickForm_image'), + 'password' =>array('HTML/QuickForm/Elements/password.php','HTML_QuickForm_password'), + 'radio' =>array('HTML/QuickForm/Elements/radio.php','HTML_QuickForm_radio'), + 'button' =>array('HTML/QuickForm/Elements/button.php','HTML_QuickForm_button'), + 'submit' =>array('HTML/QuickForm/Elements/submit.php','HTML_QuickForm_submit'), + 'select' =>array('HTML/QuickForm/Elements/select.php','HTML_QuickForm_select'), + 'text' =>array('HTML/QuickForm/Elements/text.php','HTML_QuickForm_text'), + 'textarea' =>array('HTML/QuickForm/Elements/textarea.php','HTML_QuickForm_textarea') ); + /** * Array of registered element types * @var array @@ -180,6 +191,7 @@ 'lettersonly' =>array('regex', '^[a-zA-Z]*$'), 'alphanumeric' =>array('regex', '^[a-zA-Z0-9]*$') ); + /** * Class constructor * @param string $formName Form's name. @@ -208,6 +220,7 @@ { return 1.0; } // end func apiVersion + /** * Registers a new element type * @@ -223,6 +236,7 @@ { $this->_registeredTypes[$typeName] = array($include, $className); } // end func registerElementType + /** * Registers a new validation rule * @@ -239,6 +253,7 @@ { $this->_registeredRules[$ruleName] = array($type, $data1, $data2); } // end func registerRule + /** * Returns true if element is in the form * @@ -283,6 +298,7 @@ } } } // end func loadDefaults + /** * Load form elements with submitted values * @@ -372,6 +388,7 @@ } return $elementObject; } // end func createElement + /** * Adds an element into the form * @@ -461,6 +478,7 @@ { $this->_errors[$element] = $message; } // end func setElementError + /** * Adds a header in the form * @@ -474,6 +492,7 @@ { $this->_elements[] = array("header"=>$label); } // end func addHeader + /** * Adds a validation rule for the given field * @@ -502,6 +521,7 @@ $this->_rules[$element][] = array("type"=>$type, "format"=>$format, "message"=>$message, "validation"=>$validation); } // end func addRule + /** * Html Wrapper method for form elements (inputs...) * @@ -575,6 +595,7 @@ "$tabs</TABLE>"; return $html; } // end func _wrapForm + /** * Wrap footnote for required fields * @@ -595,6 +616,7 @@ "$tabs\t</TR>"; return $html; } // end func setCaption + /** * Builds the element as part of the form * @@ -648,6 +670,7 @@ $header = $element["header"]; return $this->_wrapHeader($header); } // end func _buildHeader + /** * Returns an HTML string of the hidden form elements * @@ -731,6 +754,7 @@ "$tabs</SCRIPT>"; return $html; } // end func _buildRules + /** * Returns whether or not the form element type is supported * @@ -744,6 +768,7 @@ { return in_array($type, array_keys($this->_registeredTypes)); } // end func isTypeRegistered + /** * Returns an array of registered element types * @@ -756,6 +781,7 @@ { return array_keys($this->_registeredTypes); } // end func getRegisteredTypes + /** * Returns whether or not the given rule is supported * @@ -769,6 +795,7 @@ { return in_array($name, array_keys($this->_registeredRules)); } // end func isRuleRegistered + /** * Returns an array of registered validation rules * @@ -781,6 +808,7 @@ { return array_keys($this->_registeredRules); } // end func getRegisteredRules + /** * Returns whether or not the form element is required * @@ -794,6 +822,7 @@ { return in_array($element, $this->_required); } // end func isElementRequired + /** * Returns whether or not the form element is frozen * @@ -807,6 +836,7 @@ { return in_array($element, $this->_frozen); } // end func isElementFrozen + /** * Performs the server side validation * @access public Index: pear/HTML_QuickForm/Elements/button.php diff -u pear/HTML_QuickForm/Elements/button.php:1.1 pear/HTML_QuickForm/Elements/button.php:1.2 --- pear/HTML_QuickForm/Elements/button.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/button.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: button.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: button.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a button type element Index: pear/HTML_QuickForm/Elements/checkbox.php diff -u pear/HTML_QuickForm/Elements/checkbox.php:1.1 pear/HTML_QuickForm/Elements/checkbox.php:1.2 --- pear/HTML_QuickForm/Elements/checkbox.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/checkbox.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: checkbox.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: checkbox.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a checkbox type field Index: pear/HTML_QuickForm/Elements/date.php diff -u pear/HTML_QuickForm/Elements/date.php:1.2 pear/HTML_QuickForm/Elements/date.php:1.3 --- pear/HTML_QuickForm/Elements/date.php:1.2 Thu Sep 6 06:24:14 2001 +++ pear/HTML_QuickForm/Elements/date.php Mon Nov 5 12:06:02 2001 @@ -17,10 +17,10 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: date.php,v 1.2 2001/09/06 10:24:14 mansion Exp $ +// $Id: date.php,v 1.3 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); -require_once("HTML_QuickForm/Elements/select.php"); +require_once("HTML/QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/select.php"); // Still some features to be implemented and commented. // Use with care. This is only EXPERIMENTAL. Index: pear/HTML_QuickForm/Elements/file.php diff -u pear/HTML_QuickForm/Elements/file.php:1.1 pear/HTML_QuickForm/Elements/file.php:1.2 --- pear/HTML_QuickForm/Elements/file.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/file.php Mon Nov 5 12:06:02 2001 @@ -17,8 +17,8 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: file.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +// $Id: file.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a file type element Index: pear/HTML_QuickForm/Elements/group.php diff -u pear/HTML_QuickForm/Elements/group.php:1.1 pear/HTML_QuickForm/Elements/group.php:1.2 --- pear/HTML_QuickForm/Elements/group.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/group.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: group.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: group.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * HTML class for a form element group Index: pear/HTML_QuickForm/Elements/hidden.php diff -u pear/HTML_QuickForm/Elements/hidden.php:1.1 pear/HTML_QuickForm/Elements/hidden.php:1.2 --- pear/HTML_QuickForm/Elements/hidden.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/hidden.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: hidden.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: hidden.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a hidden type element Index: pear/HTML_QuickForm/Elements/image.php diff -u pear/HTML_QuickForm/Elements/image.php:1.1 pear/HTML_QuickForm/Elements/image.php:1.2 --- pear/HTML_QuickForm/Elements/image.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/image.php Mon Nov 5 12:06:02 2001 @@ -17,8 +17,8 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: image.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +// $Id: image.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a image type element Index: pear/HTML_QuickForm/Elements/input.php diff -u pear/HTML_QuickForm/Elements/input.php:1.1 pear/HTML_QuickForm/Elements/input.php:1.2 --- pear/HTML_QuickForm/Elements/input.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/input.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: input.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: input.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * Base class for input form elements Index: pear/HTML_QuickForm/Elements/password.php diff -u pear/HTML_QuickForm/Elements/password.php:1.1 pear/HTML_QuickForm/Elements/password.php:1.2 --- pear/HTML_QuickForm/Elements/password.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/password.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: password.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: password.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a password type field Index: pear/HTML_QuickForm/Elements/radio.php diff -u pear/HTML_QuickForm/Elements/radio.php:1.1 pear/HTML_QuickForm/Elements/radio.php:1.2 --- pear/HTML_QuickForm/Elements/radio.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/radio.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: radio.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: radio.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a radio type element Index: pear/HTML_QuickForm/Elements/reset.php diff -u pear/HTML_QuickForm/Elements/reset.php:1.1 pear/HTML_QuickForm/Elements/reset.php:1.2 --- pear/HTML_QuickForm/Elements/reset.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/reset.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: reset.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: reset.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a reset type element Index: pear/HTML_QuickForm/Elements/select.php diff -u pear/HTML_QuickForm/Elements/select.php:1.1 pear/HTML_QuickForm/Elements/select.php:1.2 --- pear/HTML_QuickForm/Elements/select.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/select.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: select.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: select.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * Class to dynamically create an HTML SELECT Index: pear/HTML_QuickForm/Elements/submit.php diff -u pear/HTML_QuickForm/Elements/submit.php:1.1 pear/HTML_QuickForm/Elements/submit.php:1.2 --- pear/HTML_QuickForm/Elements/submit.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/submit.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: submit.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: submit.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a submit type element Index: pear/HTML_QuickForm/Elements/text.php diff -u pear/HTML_QuickForm/Elements/text.php:1.1 pear/HTML_QuickForm/Elements/text.php:1.2 --- pear/HTML_QuickForm/Elements/text.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/text.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: text.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: text.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a text field Index: pear/HTML_QuickForm/Elements/textarea.php diff -u pear/HTML_QuickForm/Elements/textarea.php:1.1 pear/HTML_QuickForm/Elements/textarea.php:1.2 --- pear/HTML_QuickForm/Elements/textarea.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/textarea.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: textarea.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: textarea.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * HTML class for a textarea type field Index: pear/HTML_QuickForm/docs/QuickForm_example.php diff -u pear/HTML_QuickForm/docs/QuickForm_example.php:1.2 pear/HTML_QuickForm/docs/QuickForm_example.php:1.3 --- pear/HTML_QuickForm/docs/QuickForm_example.php:1.2 Thu Sep 13 10:29:51 2001 +++ pear/HTML_QuickForm/docs/QuickForm_example.php Mon Nov 5 12:06:02 2001 @@ -7,7 +7,7 @@ * @version 1.2 */ -require_once ("HTML_QuickForm/QuickForm.php"); +require_once ("HTML/QuickForm/QuickForm.php"); $form = new HTML_QuickForm('frmTest'); Index: pear/HTML_QuickForm/package.xml +++ pear/HTML_QuickForm/package.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- do not use the "Type" attribute here, that one is only for generated package.xml files --> <package> <name>HTML_QuickForm</name> <summary>The PEAR::HTML_QuickForm package provides methods for creating, validating, processing HTML forms.</summary> <maintainer> <user>mansion</user> <name>Bertrand Mansion</name> <email>bmansion@mamasam.com</email> </maintainer> <release> <version>1.0</version> <date>2001-09-06</date> <notes> This is the initial release of the HTML_QuickForm package. </notes> </release> <filelist> <dir name="/" baseinstalldir="HTML"> <dir name="QuickForm"> <file role="php">QuickForm.php</file> <dir name="Elements"> <file role="php">button.php</file> <file role="php">checkbox.php</file> <file role="php">date.php</file> <file role="php">element.php</file> <file role="php">file.php</file> <file role="php">group.php</file> <file role="php">hidden.php</file> <file role="php">image.php</file> <file role="php">input.php</file> <file role="php">password.php</file> <file role="php">radio.php</file> <file role="php">reset.php</file> <file role="php">select.php</file> <file role="php">submit.php</file> <file role="php">text.php</file> <file role="php">textarea.php</file> </dir> <dir name="docs" role="doc"> <file>QuickForm_example.php</file> </dir> </dir> </dir> </filelist> </package>
Index: pear/HTML_QuickForm/QuickForm.php diff -u pear/HTML_QuickForm/QuickForm.php:1.3 pear/HTML_QuickForm/QuickForm.php:1.4 --- pear/HTML_QuickForm/QuickForm.php:1.3 Tue Oct 16 09:25:27 2001 +++ pear/HTML_QuickForm/QuickForm.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,11 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: QuickForm.php,v 1.3 2001/10/16 13:25:27 mansion Exp $ +// $Id: QuickForm.php,v 1.4 2001/11/05 17:06:02 mansion Exp $ + require_once("PEAR.php"); require_once("HTML/Common.php"); + /** * Create, validate and process HTML forms * @@ -29,6 +31,7 @@ * @since PHP 4.0.3pl1 */ class HTML_QuickForm extends HTML_Common { + /** * Array containing the form fields * @since 1.0 @@ -36,6 +39,7 @@ * @access private */ var $_elements = array(); + /** * Array containing required field IDs * @since 1.0 @@ -67,6 +71,7 @@ * @access public */ var $_jsPostfix = "Please correct these fields."; + /** * Array of form values * @since 1.0 @@ -90,6 +95,7 @@ * @access public */ var $_submitFiles = array(); + /** * Value for maxfilesize hidden element if form contains file input * @since 1.0 @@ -104,6 +110,7 @@ * @access private */ var $_hidden = array(); + /** * Array containing the frozen fields * @since 1.0 @@ -119,6 +126,7 @@ * @access private */ var $_freezeAll = false; + /** * Array containing the form rules * @since 1.0 @@ -126,6 +134,7 @@ * @access private */ var $_rules = array(); + /** * Array containing the validation errors * @since 1.0 @@ -133,6 +142,7 @@ * @access private */ var $_errors = array(); + /** * Note for required fields in the form * @var string @@ -149,20 +159,21 @@ */ var $_registeredTypes = array( - 'group' =>array('HTML_QuickForm/Elements/group.php','HTML_QuickForm_group'), - 'hidden' =>array('HTML_QuickForm/Elements/hidden.php','HTML_QuickForm_hidden'), - 'reset' =>array('HTML_QuickForm/Elements/reset.php','HTML_QuickForm_reset'), - 'checkbox' =>array('HTML_QuickForm/Elements/checkbox.php','HTML_QuickForm_checkbox'), - 'file' =>array('HTML_QuickForm/Elements/file.php','HTML_QuickForm_file'), - 'image' =>array('HTML_QuickForm/Elements/image.php','HTML_QuickForm_image'), - 'password' =>array('HTML_QuickForm/Elements/password.php','HTML_QuickForm_password'), - 'radio' =>array('HTML_QuickForm/Elements/radio.php','HTML_QuickForm_radio'), - 'button' =>array('HTML_QuickForm/Elements/button.php','HTML_QuickForm_button'), - 'submit' =>array('HTML_QuickForm/Elements/submit.php','HTML_QuickForm_submit'), - 'select' =>array('HTML_QuickForm/Elements/select.php','HTML_QuickForm_select'), - 'text' =>array('HTML_QuickForm/Elements/text.php','HTML_QuickForm_text'), - 'textarea' =>array('HTML_QuickForm/Elements/textarea.php','HTML_QuickForm_textarea') + 'group' =>array('HTML/QuickForm/Elements/group.php','HTML_QuickForm_group'), + 'hidden' =>array('HTML/QuickForm/Elements/hidden.php','HTML_QuickForm_hidden'), + 'reset' =>array('HTML/QuickForm/Elements/reset.php','HTML_QuickForm_reset'), + 'checkbox' =>array('HTML/QuickForm/Elements/checkbox.php','HTML_QuickForm_checkbox'), + 'file' =>array('HTML/QuickForm/Elements/file.php','HTML_QuickForm_file'), + 'image' =>array('HTML/QuickForm/Elements/image.php','HTML_QuickForm_image'), + 'password' =>array('HTML/QuickForm/Elements/password.php','HTML_QuickForm_password'), + 'radio' =>array('HTML/QuickForm/Elements/radio.php','HTML_QuickForm_radio'), + 'button' =>array('HTML/QuickForm/Elements/button.php','HTML_QuickForm_button'), + 'submit' =>array('HTML/QuickForm/Elements/submit.php','HTML_QuickForm_submit'), + 'select' =>array('HTML/QuickForm/Elements/select.php','HTML_QuickForm_select'), + 'text' =>array('HTML/QuickForm/Elements/text.php','HTML_QuickForm_text'), + 'textarea' =>array('HTML/QuickForm/Elements/textarea.php','HTML_QuickForm_textarea') ); + /** * Array of registered element types * @var array @@ -180,6 +191,7 @@ 'lettersonly' =>array('regex', '^[a-zA-Z]*$'), 'alphanumeric' =>array('regex', '^[a-zA-Z0-9]*$') ); + /** * Class constructor * @param string $formName Form's name. @@ -208,6 +220,7 @@ { return 1.0; } // end func apiVersion + /** * Registers a new element type * @@ -223,6 +236,7 @@ { $this->_registeredTypes[$typeName] = array($include, $className); } // end func registerElementType + /** * Registers a new validation rule * @@ -239,6 +253,7 @@ { $this->_registeredRules[$ruleName] = array($type, $data1, $data2); } // end func registerRule + /** * Returns true if element is in the form * @@ -283,6 +298,7 @@ } } } // end func loadDefaults + /** * Load form elements with submitted values * @@ -372,6 +388,7 @@ } return $elementObject; } // end func createElement + /** * Adds an element into the form * @@ -461,6 +478,7 @@ { $this->_errors[$element] = $message; } // end func setElementError + /** * Adds a header in the form * @@ -474,6 +492,7 @@ { $this->_elements[] = array("header"=>$label); } // end func addHeader + /** * Adds a validation rule for the given field * @@ -502,6 +521,7 @@ $this->_rules[$element][] = array("type"=>$type, "format"=>$format, "message"=>$message, "validation"=>$validation); } // end func addRule + /** * Html Wrapper method for form elements (inputs...) * @@ -575,6 +595,7 @@ "$tabs</TABLE>"; return $html; } // end func _wrapForm + /** * Wrap footnote for required fields * @@ -595,6 +616,7 @@ "$tabs\t</TR>"; return $html; } // end func setCaption + /** * Builds the element as part of the form * @@ -648,6 +670,7 @@ $header = $element["header"]; return $this->_wrapHeader($header); } // end func _buildHeader + /** * Returns an HTML string of the hidden form elements * @@ -731,6 +754,7 @@ "$tabs</SCRIPT>"; return $html; } // end func _buildRules + /** * Returns whether or not the form element type is supported * @@ -744,6 +768,7 @@ { return in_array($type, array_keys($this->_registeredTypes)); } // end func isTypeRegistered + /** * Returns an array of registered element types * @@ -756,6 +781,7 @@ { return array_keys($this->_registeredTypes); } // end func getRegisteredTypes + /** * Returns whether or not the given rule is supported * @@ -769,6 +795,7 @@ { return in_array($name, array_keys($this->_registeredRules)); } // end func isRuleRegistered + /** * Returns an array of registered validation rules * @@ -781,6 +808,7 @@ { return array_keys($this->_registeredRules); } // end func getRegisteredRules + /** * Returns whether or not the form element is required * @@ -794,6 +822,7 @@ { return in_array($element, $this->_required); } // end func isElementRequired + /** * Returns whether or not the form element is frozen * @@ -807,6 +836,7 @@ { return in_array($element, $this->_frozen); } // end func isElementFrozen + /** * Performs the server side validation * @access public Index: pear/HTML_QuickForm/Elements/button.php diff -u pear/HTML_QuickForm/Elements/button.php:1.1 pear/HTML_QuickForm/Elements/button.php:1.2 --- pear/HTML_QuickForm/Elements/button.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/button.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: button.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: button.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a button type element Index: pear/HTML_QuickForm/Elements/checkbox.php diff -u pear/HTML_QuickForm/Elements/checkbox.php:1.1 pear/HTML_QuickForm/Elements/checkbox.php:1.2 --- pear/HTML_QuickForm/Elements/checkbox.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/checkbox.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: checkbox.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: checkbox.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a checkbox type field Index: pear/HTML_QuickForm/Elements/date.php diff -u pear/HTML_QuickForm/Elements/date.php:1.2 pear/HTML_QuickForm/Elements/date.php:1.3 --- pear/HTML_QuickForm/Elements/date.php:1.2 Thu Sep 6 06:24:14 2001 +++ pear/HTML_QuickForm/Elements/date.php Mon Nov 5 12:06:02 2001 @@ -17,10 +17,10 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: date.php,v 1.2 2001/09/06 10:24:14 mansion Exp $ +// $Id: date.php,v 1.3 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); -require_once("HTML_QuickForm/Elements/select.php"); +require_once("HTML/QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/select.php"); // Still some features to be implemented and commented. // Use with care. This is only EXPERIMENTAL. Index: pear/HTML_QuickForm/Elements/file.php diff -u pear/HTML_QuickForm/Elements/file.php:1.1 pear/HTML_QuickForm/Elements/file.php:1.2 --- pear/HTML_QuickForm/Elements/file.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/file.php Mon Nov 5 12:06:02 2001 @@ -17,8 +17,8 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: file.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +// $Id: file.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a file type element Index: pear/HTML_QuickForm/Elements/group.php diff -u pear/HTML_QuickForm/Elements/group.php:1.1 pear/HTML_QuickForm/Elements/group.php:1.2 --- pear/HTML_QuickForm/Elements/group.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/group.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: group.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: group.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * HTML class for a form element group Index: pear/HTML_QuickForm/Elements/hidden.php diff -u pear/HTML_QuickForm/Elements/hidden.php:1.1 pear/HTML_QuickForm/Elements/hidden.php:1.2 --- pear/HTML_QuickForm/Elements/hidden.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/hidden.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: hidden.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: hidden.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a hidden type element Index: pear/HTML_QuickForm/Elements/image.php diff -u pear/HTML_QuickForm/Elements/image.php:1.1 pear/HTML_QuickForm/Elements/image.php:1.2 --- pear/HTML_QuickForm/Elements/image.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/image.php Mon Nov 5 12:06:02 2001 @@ -17,8 +17,8 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: image.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +// $Id: image.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a image type element Index: pear/HTML_QuickForm/Elements/input.php diff -u pear/HTML_QuickForm/Elements/input.php:1.1 pear/HTML_QuickForm/Elements/input.php:1.2 --- pear/HTML_QuickForm/Elements/input.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/input.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: input.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: input.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * Base class for input form elements Index: pear/HTML_QuickForm/Elements/password.php diff -u pear/HTML_QuickForm/Elements/password.php:1.1 pear/HTML_QuickForm/Elements/password.php:1.2 --- pear/HTML_QuickForm/Elements/password.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/password.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: password.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: password.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a password type field Index: pear/HTML_QuickForm/Elements/radio.php diff -u pear/HTML_QuickForm/Elements/radio.php:1.1 pear/HTML_QuickForm/Elements/radio.php:1.2 --- pear/HTML_QuickForm/Elements/radio.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/radio.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: radio.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: radio.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a radio type element Index: pear/HTML_QuickForm/Elements/reset.php diff -u pear/HTML_QuickForm/Elements/reset.php:1.1 pear/HTML_QuickForm/Elements/reset.php:1.2 --- pear/HTML_QuickForm/Elements/reset.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/reset.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: reset.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: reset.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a reset type element Index: pear/HTML_QuickForm/Elements/select.php diff -u pear/HTML_QuickForm/Elements/select.php:1.1 pear/HTML_QuickForm/Elements/select.php:1.2 --- pear/HTML_QuickForm/Elements/select.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/select.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: select.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: select.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * Class to dynamically create an HTML SELECT Index: pear/HTML_QuickForm/Elements/submit.php diff -u pear/HTML_QuickForm/Elements/submit.php:1.1 pear/HTML_QuickForm/Elements/submit.php:1.2 --- pear/HTML_QuickForm/Elements/submit.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/submit.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: submit.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: submit.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a submit type element Index: pear/HTML_QuickForm/Elements/text.php diff -u pear/HTML_QuickForm/Elements/text.php:1.1 pear/HTML_QuickForm/Elements/text.php:1.2 --- pear/HTML_QuickForm/Elements/text.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/text.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: text.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: text.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/input.php"); +require_once("HTML/QuickForm/Elements/input.php"); /** * HTML class for a text field Index: pear/HTML_QuickForm/Elements/textarea.php diff -u pear/HTML_QuickForm/Elements/textarea.php:1.1 pear/HTML_QuickForm/Elements/textarea.php:1.2 --- pear/HTML_QuickForm/Elements/textarea.php:1.1 Thu Sep 6 06:08:16 2001 +++ pear/HTML_QuickForm/Elements/textarea.php Mon Nov 5 12:06:02 2001 @@ -17,9 +17,9 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: textarea.php,v 1.1 2001/09/06 10:08:16 mansion Exp $ +// $Id: textarea.php,v 1.2 2001/11/05 17:06:02 mansion Exp $ -require_once("HTML_QuickForm/Elements/element.php"); +require_once("HTML/QuickForm/Elements/element.php"); /** * HTML class for a textarea type field Index: pear/HTML_QuickForm/docs/QuickForm_example.php diff -u pear/HTML_QuickForm/docs/QuickForm_example.php:1.2 pear/HTML_QuickForm/docs/QuickForm_example.php:1.3 --- pear/HTML_QuickForm/docs/QuickForm_example.php:1.2 Thu Sep 13 10:29:51 2001 +++ pear/HTML_QuickForm/docs/QuickForm_example.php Mon Nov 5 12:06:02 2001 @@ -7,7 +7,7 @@ * @version 1.2 */ -require_once ("HTML_QuickForm/QuickForm.php"); +require_once ("HTML/QuickForm/QuickForm.php"); $form = new HTML_QuickForm('frmTest'); Index: pear/HTML_QuickForm/package.xml +++ pear/HTML_QuickForm/package.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- do not use the "Type" attribute here, that one is only for generated package.xml files --> <package> <name>HTML_QuickForm</name> <summary>The PEAR::HTML_QuickForm package provides methods for creating, validating, processing HTML forms.</summary> <maintainer> <user>mansion</user> <name>Bertrand Mansion</name> <email>bmansion@mamasam.com</email> </maintainer> <release> <version>1.0</version> <date>2001-09-06</date> <notes> This is the initial release of the HTML_QuickForm package. </notes> </release> <filelist> <dir name="/" baseinstalldir="HTML"> <dir name="QuickForm"> <file role="php">QuickForm.php</file> <dir name="Elements"> <file role="php">button.php</file> <file role="php">checkbox.php</file> <file role="php">date.php</file> <file role="php">element.php</file> <file role="php">file.php</file> <file role="php">group.php</file> <file role="php">hidden.php</file> <file role="php">image.php</file> <file role="php">input.php</file> <file role="php">password.php</file> <file role="php">radio.php</file> <file role="php">reset.php</file> <file role="php">select.php</file> <file role="php">submit.php</file> <file role="php">text.php</file> <file role="php">textarea.php</file> </dir> <dir name="docs" role="doc"> <file>QuickForm_example.php</file> </dir> </dir> </dir> </filelist> </package>