cvs: peardoc /en/package/html/html-quickform-controller faq.xml
| From: | Alexey Borzov | Date: | Fri, 12 Dec 2003 15:55:58 +0000 |
| Subject: | cvs: peardoc /en/package/html/html-quickform-controller faq.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-2038@lists.php.net to get a copy of this message | ||
avb Fri Dec 12 10:55:58 2003 EDT
Modified files:
/peardoc/en/package/html/html-quickform-controller faq.xml
Log:
Update FAQ
Index: peardoc/en/package/html/html-quickform-controller/faq.xml
diff -u peardoc/en/package/html/html-quickform-controller/faq.xml:1.2
peardoc/en/package/html/html-quickform-controller/faq.xml:1.3
--- peardoc/en/package/html/html-quickform-controller/faq.xml:1.2 Tue Nov 11 06:36:08 2003
+++ peardoc/en/package/html/html-quickform-controller/faq.xml Fri Dec 12 10:55:58 2003
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.html.html-quickform-controller.faq">
<refnamediv>
<refname>FAQ</refname>
@@ -82,16 +82,16 @@
<refsect2 id="package.html.html-quickform-controller.faq.actions.call">
<title>How to call an action handler?</title>
<para>
-You should use <classname>Page</classname>'s <link
linkend="package.html.html-quickform-controller.html-quickform-page.handle">handle</link>
method:
+You should use <classname>Page</classname>'s <link
linkend="package.html.html-quickform-controller.html-quickform-page.handle"><function>handle</function></link>
method:
<programlisting role="php">
<![CDATA[
$page->handle('action');
]]>
</programlisting>
-<classname>Controller</classname>'s <link
linkend="package.html.html-quickform-controller.html-quickform-controller.handle">handle</link>
method will be called automatically if needed.
+<classname>Controller</classname>'s <link
linkend="package.html.html-quickform-controller.html-quickform-controller.handle"><function>handle</function></link>
method will be called automatically if needed.
</para>
</refsect2>
-
+
<refsect2 id="package.html.html-quickform-controller.faq.actions.custom">
<title>How to make a custom action?</title>
<para>
@@ -109,6 +109,17 @@
As usual, see the default action handlers' source for the examples.
</para>
</refsect2>
+
+ <refsect2 id="package.html.html-quickform-controller.faq.actions.bind">
+ <title>Can actions be bound to something other than submit buttons?</title>
+ <para>
+Controller is able to properly handle actions bound to <literal><input
type="image" /></literal> controls, too. You don't have to do
anything special, just set the control's name via
<function>getButtonName</function>.
+ </para>
+ <para>
+If you want to bind an action to something like a hyperlink, you must consider the following:
<emphasis>the form must be submitted</emphasis> to be able to get its values, thus you
need to write some javascript that will submit the form and somehow pass the action name to the
controller.
+ </para>
+ </refsect2>
+
</refsect1>
@@ -174,6 +185,34 @@
</orderedlist>
</para>
</refsect1>
+
+ <refsect1 id="package.html.html-quickform-controller.faq.nonlinear">
+ <title>How to create a wizard with optional pages?</title>
+ <para>Thanks to Donald Lobo for this contribution.</para>
+ <para>Lets assume we have a three-page wizard:
+<itemizedlist>
+ <listitem><simpara>Page 1 has a control that lets the user choose the next
page.</simpara></listitem>
+ <listitem><simpara>Based on input, the user is directed to either page 2A or page
2B.</simpara></listitem>
+ <listitem><simpara>Both page 2A and 2B go to page 3 (this is commonly referred to
as a
+StateMachine in programming books). </simpara></listitem>
+</itemizedlist>
+ </para>
+ <para>
+ You need to create several action handlers based on QFC's default <link
linkend="package.html.html-quickform-controller.html-quickform-action-next-summary"><classname>HTML_QuickForm_Action_Next</classname></link>
and <link
linkend="package.html.html-quickform-controller.html-quickform-action-back-summary"><classname>HTML_QuickForm_Action_Back</classname></link>.
You can do this either at the Page level or at the Controller level. The Page level subclassing is
simple, but if you have a complex StateMachine you will end up having multiple subclasses.
+ </para>
+ <para>
+For the above example, the <literal>'next'</literal> action on page 1 sends
the 'user' to either page 2 or page 3 based on input. The handler also sets the
<literal>'valid'</literal> flag of the page that will not be visited.
+ </para>
+ <para>
+The <literal>'back'</literal> action on pages 2A and 2B sends the user back
to page 1, while the <literal>'next'</literal> action sends him to page 3.
+ </para>
+ <para>
+Finally, the <literal>'back'</literal> action handler on page 3 should
examine the input on page 1 and send the user to either 2A or 2B.
+ </para>
+ <para>
+The working example is available in <filename>statemachine.php</filename> file.
+ </para>
+ </refsect1>
</refentry>