cvs: peardoc /en/package/html/html-quickform intro-renderers.xml intro-validation.xml /en/package/html/html-quickform/html-quickform registerrule.xml
/en/package/html/html-quickform/html-quickform-date html_quickform_date.xml

From: Date: Fri, 07 Nov 2003 10:27:43 +0000
Subject: cvs: peardoc /en/package/html/html-quickform intro-renderers.xml intro-validation.xml /en/package/html/html-quickform/html-quickform registerrule.xml
/en/package/html/html-quickform/html-quickform-date html_quickform_date.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-1892@lists.php.net to get a copy of this message
avb Fri Nov 7 05:27:43 2003 EDT Modified files: /peardoc/en/package/html/html-quickform/html-quickform registerrule.xml /peardoc/en/package/html/html-quickform intro-validation.xml intro-renderers.xml /peardoc/en/package/html/html-quickform/html-quickform-date html_quickform_date.xml Log: For 3.2: updated validation-related docs once more... updated date element docs updated renderer count

Index: peardoc/en/package/html/html-quickform/html-quickform/registerrule.xml diff -u peardoc/en/package/html/html-quickform/html-quickform/registerrule.xml:1.2 peardoc/en/package/html/html-quickform/html-quickform/registerrule.xml:1.3 --- peardoc/en/package/html/html-quickform/html-quickform/registerrule.xml:1.2 Wed Aug 13 12:01:03 2003 +++ peardoc/en/package/html/html-quickform/html-quickform/registerrule.xml Fri Nov 7 05:27:41 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-quickform.html-quickform.registerrule"> <refnamediv> <refname>HTML_QuickForm::registerRule()</refname> @@ -47,7 +47,7 @@ </term> <listitem> <para> - Either: 'regex' or 'function' + Either: <literal>'regex'</literal> or <literal>'callback'</literal> (<literal>'function'</literal> is also kept for backward compatibility). If registering a subclass of <classname>HTML_QuickForm_Rule</classname> you can pass anything here, preferrably &null; or empty string. </para> </listitem> </varlistentry> @@ -59,7 +59,7 @@ </term> <listitem> <para> - Name of function or regular expression + Name of function, regular expression, classname of <classname>HTML_QuickForm_Rule</classname> subclass or an instance of such class. </para> </listitem> </varlistentry> @@ -71,7 +71,7 @@ </term> <listitem> <para> - Object parent of above function + Object parent of above function, name of the file containing the subclass of <classname>HTML_QuickForm_Rule</classname>. </para> </listitem> </varlistentry> Index: peardoc/en/package/html/html-quickform/intro-validation.xml diff -u peardoc/en/package/html/html-quickform/intro-validation.xml:1.5 peardoc/en/package/html/html-quickform/intro-validation.xml:1.6 --- peardoc/en/package/html/html-quickform/intro-validation.xml:1.5 Thu Nov 6 15:36:12 2003 +++ peardoc/en/package/html/html-quickform/intro-validation.xml Fri Nov 7 05:27:42 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="package.html.html-quickform.intro-validation"> <refnamediv> <refname>Introduction - validation and filters</refname> @@ -174,7 +174,11 @@ <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 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. +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, you basically have two options: +<orderedlist> + <listitem><para>Register the function via <link linkend="package.html.html-quickform.html-quickform.registerrule"><function>registerRule</function></link> using <literal>&apos;callback&apos;</literal> as <varname>$type</varname> and giving the new rule a custom <varname>$ruleName</varname>. Later you add the rule with this name via <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> like any buitin rule.</para></listitem> + <listitem><para>Add the rule of <varname>callback</varname> type via <link linkend="package.html.html-quickform.html-quickform.addrule"><function>addRule</function></link> passing the name of your function as <varname>$format</varname>. This way you&apos;ll have less characters to type, but will be unable to pass additional data to your function.</para></listitem> +</orderedlist> </para> <example> <title>Email validation function</title> @@ -189,18 +193,18 @@ */ function checkEmail($elementName, $email, $domainCheck = false) { - if (preg_match('/^[a-zA-Z0-9\._-]+\@(\[?)[a-zA-Z0-9\-\.]+'. - '\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/', $email)) { - if ($domainCheck && function_exists('checkdnsrr')) { - list (, $domain) = explode('@', $email); - if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) { - return true; - } - return false; - } - return true; - } - return false; + if (preg_match('/^[a-zA-Z0-9\._-]+\@(\[?)[a-zA-Z0-9\-\.]+'. + '\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/', $email)) { + if ($domainCheck && function_exists('checkdnsrr')) { + list (, $domain) = explode('@', $email); + if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) { + return true; + } + return false; + } + return true; + } + return false; } $form->registerRule('checkmail', 'callback', 'checkEmail'); $form->addRule('email', 'Email is incorrect', 'checkmail', true); @@ -248,7 +252,7 @@ $rule['code'][] = array('Code is required', 'required'); $rule['code'][] = array('Code contains numbers only', 'regex', '/^\d+$/'); -$rule['code'][] = array('Code is 5 numbers long', 'minlength', 5); +$rule['code'][] = array('Code is 5 numbers long', 'rangelength', array(5, 5)); $form->addGroupRule('id', $rule); ]]> Index: peardoc/en/package/html/html-quickform/intro-renderers.xml diff -u peardoc/en/package/html/html-quickform/intro-renderers.xml:1.1 peardoc/en/package/html/html-quickform/intro-renderers.xml:1.2 --- peardoc/en/package/html/html-quickform/intro-renderers.xml:1.1 Fri May 23 10:21:32 2003 +++ peardoc/en/package/html/html-quickform/intro-renderers.xml Fri Nov 7 05:27:42 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-quickform.intro-renderers"> <refnamediv> <refname>Introduction - renderers</refname> @@ -29,8 +29,7 @@ It is much easier to add new output method. </para></listitem> </orderedlist> -There are 5 renderers currently available, of which 2 are based on pre-3.0 code and 3 -are new. +There are 8 renderers available since release 3.1.1, of which 2 are based on pre-3.0 code and 6 are new. The following template engines are directly suported: Smarty, HTML_Template_Sigma, HTML_Template_IT, HTML_Template_Flexy. </para> <para> Index: peardoc/en/package/html/html-quickform/html-quickform-date/html_quickform_date.xml diff -u peardoc/en/package/html/html-quickform/html-quickform-date/html_quickform_date.xml:1.1 peardoc/en/package/html/html-quickform/html-quickform-date/html_quickform_date.xml:1.2 --- peardoc/en/package/html/html-quickform/html-quickform-date/html_quickform_date.xml:1.1 Tue Oct 28 15:30:22 2003 +++ peardoc/en/package/html/html-quickform/html-quickform-date/html_quickform_date.xml Fri Nov 7 05:27:43 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-quickform.html-quickform-date.html-quickform-date"> <refnamediv> <refname>constructor HTML_QuickForm_date()</refname> @@ -47,6 +47,7 @@ F => Long names of months m => Month numbers Y => Four digit year +y => Two digit year h => 12 hour format H => 23 hour format i => Minutes @@ -70,7 +71,12 @@ <term><literal>&apos;maxYear&apos;</literal></term> <listitem><para> Maximum year in year select. Default is 2010. - </para></listitem> + </para> + <note> + <title>On <literal>&apos;minYear&apos;</literal> and <literal>&apos;maxYear&apos;</literal></title> + <para>When <literal>&apos;minYear&apos;</literal> &gt; <literal>&apos;maxYear&apos;</literal> the years in the select will be displayed in descending order.</para> + </note> + </listitem> </varlistentry> <varlistentry> @@ -91,6 +97,13 @@ <term><literal>&apos;emptyOptionText&apos;</literal></term> <listitem><para> The text displayed for the empty option. Default is <literal>&apos;&amp;nbsp;&apos;</literal>. + </para></listitem> + </varlistentry> + + <varlistentry> + <term><literal>&apos;optionIncrement&apos;</literal></term> + <listitem><para> + Step to increase the option values by. Works for <literal>'i'</literal> and <literal>'s'</literal> formats currently. Default is array('i' => 1, 's' => 1). </para></listitem> </varlistentry> </variablelist>
« previous php.pear.doc (#1892) next »