cvs: peardoc /en/package/html html-quickform.xml /en/package/html/html-quickform html-quickform-text.xml intro-elements.xml intro-validation.xml
/en/package/html/html-quickform/html-quickform addgrouprule.xml addrule.xml exportvalue.xml exportvalues.xml html_quickform.xml

From: Date: Thu, 06 Nov 2003 20:36:14 +0000
Subject: cvs: peardoc /en/package/html html-quickform.xml /en/package/html/html-quickform html-quickform-text.xml intro-elements.xml intro-validation.xml
/en/package/html/html-quickform/html-quickform addgrouprule.xml addrule.xml exportvalue.xml exportvalues.xml html_quickform.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-1885@lists.php.net to get a copy of this message
avb Thu Nov 6 15:36:14 2003 EDT Modified files: /peardoc/en/package/html/html-quickform intro-validation.xml intro-elements.xml html-quickform-text.xml /peardoc/en/package/html/html-quickform/html-quickform html_quickform.xml exportvalues.xml exportvalue.xml addrule.xml addgrouprule.xml /peardoc/en/package/html html-quickform.xml Log: Added docs for autocomplete element Update validation docs for 3.2 Clarified some parts a bit

Index: peardoc/en/package/html/html-quickform/intro-validation.xml diff -u peardoc/en/package/html/html-quickform/intro-validation.xml:1.4 peardoc/en/package/html/html-quickform/intro-validation.xml:1.5 --- peardoc/en/package/html/html-quickform/intro-validation.xml:1.4 Wed Sep 3 09:05:35 2003 +++ peardoc/en/package/html/html-quickform/intro-validation.xml Thu Nov 6 15:36:12 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="package.html.html-quickform.intro-validation"> <refnamediv> <refname>Introduction - validation and filters</refname> @@ -13,7 +13,7 @@ offers to make validation easier. </para> <para> -QuickForm can verify if required elements are filled when the form is submitted. This works with every type of elements or groups. QuickForm uses an internal regular expression to check if the element is empty. The 0 integer is not considered as an empty value. The fact that an element is required triggers the use of the other validation rules set for that same element. +QuickForm can verify if required elements are filled when the form is submitted. This works with every type of elements or groups, integer 0 is not considered as an empty value. <programlisting role="php"> <![CDATA[ require_once 'HTML/QuickForm.php'; @@ -35,6 +35,18 @@ ]]> </programlisting> </para> + <note> + <title>On empty elements validation</title> + <para> +If the element is empty, no validation rules other than <varname>required</varname> are checked for it. This means that empty element can be invalid <emphasis>only</emphasis> when it is required. + </para> + </note> + <note> + <title>On required uploads</title> + <para> +<varname>required</varname> rule does not work for file elements. Use <varname>uploadedfile</varname>. + </para> + </note> <para> The <function>HTML_QuickForm::validate</function> method will scan through each rules in the order they have been set. If a rule is not validated, the error message corresponding to the element will be displayed and the form will be shown once again. You can use templates to set the position of this error message. The order you decide to set your validation rules is important because it will determine which error message is used. </para> @@ -42,7 +54,7 @@ <refsect2 id="package.html.html-quickform.intro-validation.rules.client"> <title>Client-side validation</title> <para> -QuickForm can generate the javascript necessary to validate the form on the client side. This feature works for every standard elements. Groups will be validated on the client side by concatenating all grouped elements value into a single value. Server side validation is always performed in case the client has javascript turned off. +QuickForm can generate the javascript necessary to validate the form on the client side. This feature works for all standard elements and for groups. Server side validation is always performed in case the client has javascript turned off. <programlisting role="php"> <![CDATA[ $form->addRule('email', 'E-Mail is required', 'required', null, 'client'); @@ -50,14 +62,15 @@ </programlisting> </para> <tip><para> -By setting the parameter 'client', you trigger the javascript automatic generation. +By setting the parameter <literal>'client'</literal>, you trigger the javascript automatic generation. </para></tip> </refsect2> <refsect2 id="package.html.html-quickform.intro-validation.rules.builtin"> <title>Built-in validation rules</title> <para> -QuickForm offers a few registered rules that are often used when validating forms. These actually are regular expressions ready to use, 'required' is one of those. +QuickForm offers a few registered rules that are often used when validating forms. <variablelist> + <title>Simple validation rules</title> <varlistentry> <term><varname>required</varname></term> <listitem><para>value is not empty</para></listitem> @@ -103,7 +116,46 @@ <listitem><para>value must be a number not starting with 0</para></listitem> </varlistentry> </variablelist> + + <variablelist> + <title>Validation rules for file uploads</title> + <varlistentry> + <term><varname>uploadedfile</varname></term> + <listitem><para>Required file upload</para></listitem> + </varlistentry> + <varlistentry> + <term><varname>maxfilesize</varname></term> + <listitem><para>The file size must not exceed the given number of bytes</para></listitem> + </varlistentry> + <varlistentry> + <term><varname>mimetype</varname></term> + <listitem><para>The file must have a correct mimetype</para></listitem> + </varlistentry> + <varlistentry> + <term><varname>filename</varname></term> + <listitem><para>The filename must match the given regex</para></listitem> + </varlistentry> + </variablelist> + + <variablelist> + <title>Other rules</title> + <varlistentry> + <term><varname>callback</varname></term> + <listitem><para>This rule allows to use an external function/method for validation, either by registering it or by passing a callback as a format parameter.</para></listitem> + </varlistentry> + <varlistentry> + <term><varname>compare</varname></term> + <listitem><para>The rule allows to compare the values of two form fields. This can be used for e.g. 'Password repeat must match password' kind of rule.</para></listitem> + </varlistentry> + </variablelist> </para> + <note> + <title>On rules for file uploads</title> + <para> +These rules are defined in <filename>HTML/QuickForm/file.php</filename>, and are automatically registered when a <varname>file</varname> type element is added to the form. These rules are server-side only, for obvious reasons. + </para> + </note> + <para> Some of these rules require an extra <varname>format</varname> parameter in order to work correctly. For example, the <varname>regex</varname> rule can be used this way to validate a signed integer: <programlisting role="php"> @@ -113,10 +165,16 @@ </programlisting> </para> </refsect2> + <refsect2 id="package.html.html-quickform.intro-validation.rules.classes"> + <title>Validation classes</title> + <para> +Since release 3.2 all builtin validation is performed by subclasses of <classname>HTML_QuickForm_Rule</classname> class. You can create your own subclass of it and implement <function>validate</function> and <function>getValidationScript</function> methods. Consult the source for the examples. + </para> + </refsect2> <refsect2 id="package.html.html-quickform.intro-validation.rules.functions"> <title>Validation functions and methods</title> <para> -When you need a more complex validation, QuickForm can use your own custom-made functions to validate an element or a group. QuickForm can also call a method inside a class. This way, it is possible to use PEAR's <classname>Validate</classname> package or any other class. If you want to use your own functions, QuickForm needs a way to find them, so they have to be registered first. Validation with function is done even if the element is not required. +When you need a more complex validation, QuickForm can use your own custom-made functions to validate an element or a group. QuickForm can also call a method of a class. This way, it is possible to use PEAR's <classname>Validate</classname> package or any other class. If you want to use your own functions, QuickForm needs a way to find them, so they have to be registered first. Validation with function is done even if the element is not required. </para> <example> <title>Email validation function</title> @@ -144,7 +202,7 @@ } return false; } -$form->registerRule('checkmail', 'function', 'checkEmail'); +$form->registerRule('checkmail', 'callback', 'checkEmail'); $form->addRule('email', 'Email is incorrect', 'checkmail', true); ]]> </programlisting> @@ -157,7 +215,7 @@ <programlisting role="php"> <![CDATA[ // Method checkEmail is in class Validate -$form->registerRule('checkmail', 'function', 'checkEmail', 'Validate'); +$form->registerRule('checkmail', 'callback', 'checkEmail', 'Validate'); ]]> </programlisting> </para> @@ -168,7 +226,7 @@ <refsect2 id="package.html.html-quickform.intro-validation.rules.groups"> <title>Group validation</title> <para> -Groups of elements can be validated the same way other elements are, or use a more complex validation scheme. To validate a group as a whole, just use <function>HTML_QuickForm::addRule</function>. All your elements will then be validated one after the other using the same rule. If you use a validation function, every element values will be passed to the function as an array. If you use client-side validation, element values will be concatenated before being validated. +Groups of elements can be validated the same way other elements are, or use a more complex validation scheme. To validate a group as a whole, just use <function>HTML_QuickForm::addRule</function>. The group elements' values will be passed to the validation function as an array. </para> <para> You can have more complex validation for your groups using the <function>HTML_QuickForm::addGroupRule</function> method. This allows for a per element validation. It also makes it possible to specify the number of elements that need to be valid for the group to be valid too. @@ -186,11 +244,11 @@ $rule['username'][] = array('Username is required', 'required'); $rule['username'][] = array('Username contains only letters', 'lettersonly'); -$rule['username'][] = array('Username has between 5-8 characters', 'rangelength', '5,8'); +$rule['username'][] = array('Username has between 5-8 characters', 'rangelength', array(5, 8)); $rule['code'][] = array('Code is required', 'required'); $rule['code'][] = array('Code contains numbers only', 'regex', '/^\d+$/'); -$rule['code'][] = array('Code is 5 numbers long', 'rangelength', '5'); +$rule['code'][] = array('Code is 5 numbers long', 'minlength', 5); $form->addGroupRule('id', $rule); ]]> @@ -200,7 +258,7 @@ In this example, we have set rules for the elements inside our group. Instead of using their names, we could have used their index (determined by the order they were created) in the group, it would speed up the validation process. </para> <para> -The following example takes the same group and will validate the form only if at least one of our two elements is not empty. To acheive this, we use the <parameter>howmany</parameter> parameter and set it to 1. +The following example takes the same group and will validate the form only if at least one of our two elements is not empty. To achieve this, we use the <parameter>howmany</parameter> parameter and set it to 1. <programlisting role="php"> <![CDATA[ $form->addGroupRule('id', 'Fill at least one element', 'required', null, 1); Index: peardoc/en/package/html/html-quickform/intro-elements.xml diff -u peardoc/en/package/html/html-quickform/intro-elements.xml:1.5 peardoc/en/package/html/html-quickform/intro-elements.xml:1.6 --- peardoc/en/package/html/html-quickform/intro-elements.xml:1.5 Thu Oct 30 16:06:42 2003 +++ peardoc/en/package/html/html-quickform/intro-elements.xml Thu Nov 6 15:36:12 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="package.html.html-quickform.intro-elements"> <refnamediv> <refname>QuickForm element types</refname> @@ -7,7 +7,7 @@ <refsect1 id="package.html.html-quickform.intro-elements.overview"> <title>Elements overview</title> <para> -As of release 3.1, <classname>HTML_QuickForm</classname> knows 21 element types that can be created via <link linkend="package.html.html-quickform.html-quickform.createelement"><function>createElement</function></link> and added to the form via <link linkend="package.html.html-quickform.html-quickform.addelement"><function>addElement</function></link>. These can be divided into two big groups: standard HTML elements and custom elements. +As of release 3.2, <classname>HTML_QuickForm</classname> knows 22 element types that can be created via <link linkend="package.html.html-quickform.html-quickform.createelement"><function>createElement</function></link> and added to the form via <link linkend="package.html.html-quickform.html-quickform.addelement"><function>addElement</function></link>. These can be divided into two big groups: standard HTML elements and custom elements. </para> <variablelist> @@ -107,6 +107,13 @@ <term><literal>&apos;advcheckbox&apos;</literal></term> <listitem><para> Class for an advanced checkbox type field, <link linkend="package.html.html-quickform.html-quickform-advcheckbox"><classname>HTML_QuickForm_advcheckbox</classname></link>. Basically this fixes a problem that HTML has had where checkboxes can only pass a single value (the value of the checkbox when checked). + </para></listitem> + </varlistentry> + + <varlistentry> + <term><literal>&apos;autocomplete&apos;</literal></term> + <listitem><para> + Class for a text field with autocompletion feature, <link linkend="package.html.html-quickform.html-quickform-autocomplete"><classname>HTML_QuickForm_autocomplete</classname></link>. The element looks like a normal HTML input text element that at every keypressed javascript event, searches the array of options for a match and autocompletes the text in case of match. </para></listitem> </varlistentry> Index: peardoc/en/package/html/html-quickform/html-quickform-text.xml diff -u peardoc/en/package/html/html-quickform/html-quickform-text.xml:1.1 peardoc/en/package/html/html-quickform/html-quickform-text.xml:1.2 --- peardoc/en/package/html/html-quickform/html-quickform-text.xml:1.1 Tue Oct 28 09:58:01 2003 +++ peardoc/en/package/html/html-quickform/html-quickform-text.xml Thu Nov 6 15:36:12 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-quickform.html-quickform-text"> <refnamediv> <refname>Class Summary <classname>HTML_QuickForm_text</classname></refname> @@ -32,6 +32,25 @@ </para></listitem> </itemizedlist> </para> + <para> + <table> + <title>Classes that extend <classname>HTML_QuickForm_text</classname></title> + <tgroup cols="2"> + <thead> + <row> + <entry>Class</entry> + <entry>Summary</entry> + </row> + </thead> + <tbody> + <row> + <entry><link linkend="package.html.html-quickform.html-quickform-autocomplete">HTML_QuickForm_autocomplete</link></entry> + <entry>HTML class for a text field with autocompletion feature</entry> + </row> + </tbody> + </tgroup> + </table> + </para> <para> <classname>HTML_QuickForm_text</classname> Inherited Methods </para> Index: peardoc/en/package/html/html-quickform/html-quickform/html_quickform.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/html_quickform.xml:1.2 peardoc/en/package/html/html-quickform/html-quickform/html_quickform.xml:1.3 --- peardoc/en/package/html/html-quickform/html-quickform/html_quickform.xml:1.2 Wed Aug 13 12:01:03 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/html_quickform.xml Thu Nov 6 15:36:13 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-quickform.html-quickform.html-quickform"> <refnamediv> <refname>constructor HTML_QuickForm::HTML_QuickForm()</refname> @@ -16,6 +16,7 @@ <paramdef>string <parameter> <optional>$action = ''</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$target = '_self'</optional></parameter></paramdef> <paramdef>mixed <parameter> <optional>$attributes = &null;</optional></parameter></paramdef> + <paramdef>bool <parameter> <optional>$trackSubmit = &false;</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -85,6 +86,18 @@ <listitem> <para> (optional) Extra attributes for &lt;form&gt; tag + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + + &type.bool; + <parameter>$trackSubmit</parameter> + </term> + <listitem> + <para> + (optional) Whether to track if the form was submitted by adding a special hidden field. If the name of such field is not present in the <varname>$_GET</varname> or <varname>$_POST</varname> values, the form will be considered as not submitted. </para> </listitem> </varlistentry> Index: peardoc/en/package/html/html-quickform/html-quickform/exportvalues.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/exportvalues.xml:1.2 peardoc/en/package/html/html-quickform/html-quickform/exportvalues.xml:1.3 --- peardoc/en/package/html/html-quickform/html-quickform/exportvalues.xml:1.2 Wed Aug 13 12:01:03 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/exportvalues.xml Thu Nov 6 15:36:13 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-quickform.html-quickform.exportvalues"> <refnamediv> <refname>HTML_QuickForm::exportValues()</refname> @@ -19,7 +19,7 @@ <refsect1 id="package.html.html-quickform.html-quickform.exportvalues.desc"> &title.desc; <para>Returns the values for the form elements. First it tries to return <link linkend="package.html.html-quickform.intro-validation.filters">filtered</link> submitted values, if there were none then it takes the values set by <link linkend="package.html.html-quickform.html-quickform.setdefaults"><function>setDefaults</function></link> or <link linkend="package.html.html-quickform.html-quickform.setconstants"><function>setConstants</function></link>.</para> - <para>Unlike <link linkend="package.html.html-quickform.html-quickform.getsubmitvalues"><function>getSubmitValues</function></link>, this will return only the values corresponding to the elements <link linkend="package.html.html-quickform.html-quickform.addelement">added to the form</link> and only the values that could actually be submitted: if we have 'Yes'/'No' radiobuttons 'Maybe' will not be considered a valid submit value.</para> + <para>Unlike <link linkend="package.html.html-quickform.html-quickform.getsubmitvalues"><function>getSubmitValues</function></link>, this will return only the values corresponding to the elements <link linkend="package.html.html-quickform.html-quickform.addelement">added to the form</link> and only the values that could actually be submitted: if we have 'Yes'/'No' radiobuttons 'Maybe' will not be considered a valid submit value. You also cannot get values for file elements via this method.</para> </refsect1> <refsect1 id="package.html.html-quickform.html-quickform.exportvalues.param"> &title.param; Index: peardoc/en/package/html/html-quickform/html-quickform/exportvalue.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/exportvalue.xml:1.1 peardoc/en/package/html/html-quickform/html-quickform/exportvalue.xml:1.2 --- peardoc/en/package/html/html-quickform/html-quickform/exportvalue.xml:1.1 Mon Aug 11 11:50:01 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/exportvalue.xml Thu Nov 6 15:36:13 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-quickform.html-quickform.exportvalue"> <refnamediv> <refname>HTML_QuickForm::exportValue()</refname> @@ -18,8 +18,9 @@ <refsect1 id="package.html.html-quickform.html-quickform.exportvalue.desc"> &title.desc; - <para>This method first tries to find a <link linkend="package.html.html-quickform.intro-validation.filters">cleaned-up</link> submitted value, it will return a value set by setValue()/<link linkend="package.html.html-quickform.html-quickform.setdefaults"><function>setDefaults</function></link>/<link linkend="package.html.html-quickform.html-quickform.setconstants"><function>setConstants</function></link> if submitted value does not exist for the given element.</para> + <para>This method first tries to find a <link linkend="package.html.html-quickform.intro-validation.filters">cleaned-up</link> submitted value, it will return a value set by <link linkend="package.html.html-quickform.html-quickform-element.setvalue"><function>setValue</function></link>/<link linkend="package.html.html-quickform.html-quickform.setdefaults"><function>setDefaults</function></link>/<link linkend="package.html.html-quickform.html-quickform.setconstants"><function>setConstants</function></link> if submitted value does not exist for the given element.</para> <para>The value that couldn't have possibly been submitted (e.g.: an option that is not present in &lt;select&gt; element's option list) is not considered valid and is not returned.</para> + <para>As the values returned by this method and by <function>exportValues</function> are expected to be immediately processed and/or stored somewhere, values for file elements that obviously have special processing needs are not returned.</para> </refsect1> <refsect1 id="package.html.html-quickform.html-quickform.exportvalue.param"> &title.param; Index: peardoc/en/package/html/html-quickform/html-quickform/addrule.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/addrule.xml:1.3 peardoc/en/package/html/html-quickform/html-quickform/addrule.xml:1.4 --- peardoc/en/package/html/html-quickform/html-quickform/addrule.xml:1.3 Wed Aug 13 12:01:03 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/addrule.xml Thu Nov 6 15:36:13 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-quickform.html-quickform.addrule"> <refnamediv> <refname>HTML_QuickForm::addRule()</refname> @@ -11,7 +11,7 @@ </funcsynopsisinfo> <funcprototype> <funcdef>void <function>HTML_QuickForm::addRule</function></funcdef> - <paramdef>string <parameter>$element</parameter></paramdef> + <paramdef>mixed <parameter>$element</parameter></paramdef> <paramdef>string <parameter>$message</parameter></paramdef> <paramdef>string <parameter>$type</parameter></paramdef> <paramdef>string <parameter> <optional>$format = ''</optional></parameter></paramdef> @@ -24,7 +24,7 @@ <refsect1 id="package.html.html-quickform.html-quickform.addrule.desc"> &title.desc; - <para>If the element is in fact a group, it will be considered as a whole. To validate grouped elements as separate entities, use <link linkend="package.html.html-quickform.html-quickform.addgrouprule"><function>addGroupRule</function></link>.</para> + <para>If the element is in fact a group, it will be considered as a whole, an array of group elements' values will be passed to validation function. To validate grouped elements as separate entities, use <link linkend="package.html.html-quickform.html-quickform.addgrouprule"><function>addGroupRule</function></link>.</para> </refsect1> <refsect1 id="package.html.html-quickform.html-quickform.addrule.param"> &title.param; @@ -33,12 +33,20 @@ <varlistentry> <term> - &type.string; + &type.mixed; <parameter>$element</parameter> </term> <listitem> <para> - Form element name + Form element name(s). Currently the only builtin rule that expects and correctly handles an array here is <varname>compare</varname>: +<programlisting role="php"> +<![CDATA[ +$form->addElement('password', 'cmpPasswd', 'Password:'); +$form->addElement('password', 'cmpRepeat', 'Repeat password:'); +$form->addRule(array('cmpPasswd', 'cmpRepeat'), 'The passwords do not match', 'compare', null, 'client'); +]]> +</programlisting> +All other builtin rules will only handle a single element name. </para> </listitem> </varlistentry> @@ -62,7 +70,7 @@ </term> <listitem> <para> - Rule type, use <link linkend="package.html.html-quickform.html-quickform.getregisteredrules"><function>getRegisteredRules</function></link> to get types + Rule type, use <link linkend="package.html.html-quickform.html-quickform.getregisteredrules"><function>getRegisteredRules</function></link> to get types. You can also pass a classname for a descendant of <classname>HTML_QuickForm_Rule</classname> or an instance of such class. </para> </listitem> </varlistentry> Index: peardoc/en/package/html/html-quickform/html-quickform/addgrouprule.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/addgrouprule.xml:1.3 peardoc/en/package/html/html-quickform/html-quickform/addgrouprule.xml:1.4 --- peardoc/en/package/html/html-quickform/html-quickform/addgrouprule.xml:1.3 Wed Oct 22 11:27:00 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/addgrouprule.xml Thu Nov 6 15:36:13 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-quickform.html-quickform.addgrouprule"> <refnamediv> <refname>HTML_QuickForm::addGroupRule()</refname> @@ -17,6 +17,7 @@ <paramdef>string <parameter> <optional>$format = ''</optional></parameter></paramdef> <paramdef>int <parameter> <optional>$howmany = 0</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$validation = 'server'</optional></parameter></paramdef> + <paramdef>bool <parameter> <optional>$reset = &false;</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -24,7 +25,7 @@ <refsect1 id="package.html.html-quickform.html-quickform.addgrouprule.desc"> &title.desc; <para>Adds a validation rule for the given group of elements</para> - <para>Only groups with a name can be assigned a validation rule. Use <function>addGroupRule</function> when you need to validate elements inside the group. Also use <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> if you need to validate the group as a whole. In this case, the same rule will be applied to all elements in the group. Use <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> if you need to validate the group against a function.</para> + <para>Only groups with a name can be assigned a validation rule. Use <function>addGroupRule</function> when you need to validate elements inside the group. Also use <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> if you need to validate the group as a whole.</para> </refsect1> <refsect1 id="package.html.html-quickform.html-quickform.addgrouprule.param"> &title.param; @@ -50,7 +51,25 @@ </term> <listitem> <para> - Array for multiple elements or error message string for one element + Array for multiple elements or error message string for one element. If this is the array, its structure is the following: +<programlisting> +<![CDATA[ +array ( + 'element name or index' => array( + array(rule data), + ... + array(rule data) + ), + ... + 'element name or index' => array( + array(rule data), + ... + array(rule data) + ) +) +]]> +</programlisting> +rule data here matches the parameters' order and meaning for <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> method. </para> </listitem> </varlistentry> @@ -62,7 +81,7 @@ </term> <listitem> <para> - (optional) Rule type. Use <link linkend="package.html.html-quickform.html-quickform.getregisteredrules"><function>getRegisteredRules</function></link> to get types. + (optional) Rule type. Use <link linkend="package.html.html-quickform.html-quickform.getregisteredrules"><function>getRegisteredRules</function></link> to get types. You can also pass a classname for a descendant of <classname>HTML_QuickForm_Rule</classname> or an instance of such class. </para> </listitem> </varlistentry> @@ -99,6 +118,18 @@ <listitem> <para> (optional)Where to perform validation: &quot;server&quot;, &quot;client&quot; + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + + &type.bool; + <parameter>$reset</parameter> + </term> + <listitem> + <para> + Client-side: whether to reset the element's value to its original state if validation failed. </para> </listitem> </varlistentry> Index: peardoc/en/package/html/html-quickform.xml diff -u peardoc/en/package/html/html-quickform.xml:1.18 peardoc/en/package/html/html-quickform.xml:1.19 --- peardoc/en/package/html/html-quickform.xml:1.18 Thu Nov 6 10:56:57 2003 +++ peardoc/en/package/html/html-quickform.xml Thu Nov 6 15:36:14 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <sect1 id="package.html.html-quickform"> <title>HTML_QuickForm</title> <para> @@ -156,6 +156,10 @@ &package.html.html-quickform.html-quickform-advcheckbox.getonclickjs; &package.html.html-quickform.html-quickform-advcheckbox.getprivatename; &package.html.html-quickform.html-quickform-advcheckbox.setvalues; + +&package.html.html-quickform.html-quickform-autocomplete; +&package.html.html-quickform.html-quickform-autocomplete.html-quickform-autocomplete; +&package.html.html-quickform.html-quickform-autocomplete.setoptions; &package.html.html-quickform.html-quickform-date; &package.html.html-quickform.html-quickform-date.html-quickform-date;
« previous php.pear.doc (#1885) next »