Zend_Form-Advanced.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.form.advanced">
  4. <title>Advanced Zend_Form Usage</title>
  5. <para>
  6. <classname>Zend_Form</classname> has a wealth of functionality, much of it aimed
  7. at experienced developers. This chapter aims to document some of this
  8. functionality with examples and use cases.
  9. </para>
  10. <sect2 id="zend.form.advanced.arrayNotation">
  11. <title>Array Notation</title>
  12. <para>
  13. Many experienced web developers like to group related form elements
  14. using array notation in the element names. For example, if you have
  15. two addresses you wish to capture, a shipping and a billing address,
  16. you may have identical elements; by grouping them in an array, you
  17. can ensure they are captured separately. Take the following form,
  18. for example:
  19. </para>
  20. <programlisting language="html"><![CDATA[
  21. <form>
  22. <fieldset>
  23. <legend>Shipping Address</legend>
  24. <dl>
  25. <dt><label for="recipient">Ship to:</label></dt>
  26. <dd><input name="recipient" type="text" value="" /></dd>
  27. <dt><label for="address">Address:</label></dt>
  28. <dd><input name="address" type="text" value="" /></dd>
  29. <dt><label for="municipality">City:</label></dt>
  30. <dd><input name="municipality" type="text" value="" /></dd>
  31. <dt><label for="province">State:</label></dt>
  32. <dd><input name="province" type="text" value="" /></dd>
  33. <dt><label for="postal">Postal Code:</label></dt>
  34. <dd><input name="postal" type="text" value="" /></dd>
  35. </dl>
  36. </fieldset>
  37. <fieldset>
  38. <legend>Billing Address</legend>
  39. <dl>
  40. <dt><label for="payer">Bill To:</label></dt>
  41. <dd><input name="payer" type="text" value="" /></dd>
  42. <dt><label for="address">Address:</label></dt>
  43. <dd><input name="address" type="text" value="" /></dd>
  44. <dt><label for="municipality">City:</label></dt>
  45. <dd><input name="municipality" type="text" value="" /></dd>
  46. <dt><label for="province">State:</label></dt>
  47. <dd><input name="province" type="text" value="" /></dd>
  48. <dt><label for="postal">Postal Code:</label></dt>
  49. <dd><input name="postal" type="text" value="" /></dd>
  50. </dl>
  51. </fieldset>
  52. <dl>
  53. <dt><label for="terms">I agree to the Terms of Service</label></dt>
  54. <dd><input name="terms" type="checkbox" value="" /></dd>
  55. <dt></dt>
  56. <dd><input name="save" type="submit" value="Save" /></dd>
  57. </dl>
  58. </form>
  59. ]]></programlisting>
  60. <para>
  61. In this example, the billing and shipping address contain some
  62. identical fields, which means one would overwrite the other. We can
  63. solve this solution using array notation:
  64. </para>
  65. <programlisting language="html"><![CDATA[
  66. <form>
  67. <fieldset>
  68. <legend>Shipping Address</legend>
  69. <dl>
  70. <dt><label for="shipping-recipient">Ship to:</label></dt>
  71. <dd><input name="shipping[recipient]" id="shipping-recipient"
  72. type="text" value="" /></dd>
  73. <dt><label for="shipping-address">Address:</label></dt>
  74. <dd><input name="shipping[address]" id="shipping-address"
  75. type="text" value="" /></dd>
  76. <dt><label for="shipping-municipality">City:</label></dt>
  77. <dd><input name="shipping[municipality]" id="shipping-municipality"
  78. type="text" value="" /></dd>
  79. <dt><label for="shipping-province">State:</label></dt>
  80. <dd><input name="shipping[province]" id="shipping-province"
  81. type="text" value="" /></dd>
  82. <dt><label for="shipping-postal">Postal Code:</label></dt>
  83. <dd><input name="shipping[postal]" id="shipping-postal"
  84. type="text" value="" /></dd>
  85. </dl>
  86. </fieldset>
  87. <fieldset>
  88. <legend>Billing Address</legend>
  89. <dl>
  90. <dt><label for="billing-payer">Bill To:</label></dt>
  91. <dd><input name="billing[payer]" id="billing-payer"
  92. type="text" value="" /></dd>
  93. <dt><label for="billing-address">Address:</label></dt>
  94. <dd><input name="billing[address]" id="billing-address"
  95. type="text" value="" /></dd>
  96. <dt><label for="billing-municipality">City:</label></dt>
  97. <dd><input name="billing[municipality]" id="billing-municipality"
  98. type="text" value="" /></dd>
  99. <dt><label for="billing-province">State:</label></dt>
  100. <dd><input name="billing[province]" id="billing-province"
  101. type="text" value="" /></dd>
  102. <dt><label for="billing-postal">Postal Code:</label></dt>
  103. <dd><input name="billing[postal]" id="billing-postal"
  104. type="text" value="" /></dd>
  105. </dl>
  106. </fieldset>
  107. <dl>
  108. <dt><label for="terms">I agree to the Terms of Service</label></dt>
  109. <dd><input name="terms" type="checkbox" value="" /></dd>
  110. <dt></dt>
  111. <dd><input name="save" type="submit" value="Save" /></dd>
  112. </dl>
  113. </form>
  114. ]]></programlisting>
  115. <para>
  116. In the above sample, we now get separate addresses. In the submitted
  117. form, we'll now have three elements, the 'save' element for the
  118. submit, and then two arrays, 'shipping' and 'billing', each with
  119. keys for their various elements.
  120. </para>
  121. <para>
  122. <classname>Zend_Form</classname> attempts to automate this process with its
  123. <link linkend="zend.form.forms.subforms">sub forms</link>. By
  124. default, sub forms render using the array notation as shown in the
  125. previous <acronym>HTML</acronym> form listing, complete with ids. The array name is
  126. based on the sub form name, with the keys based on the elements
  127. contained in the sub form. Sub forms may be nested arbitrarily deep,
  128. and this will create nested arrays to reflect the structure.
  129. Additionally, the various validation routines in
  130. <classname>Zend_Form</classname> honor the array structure, ensuring that your
  131. form validates correctly, no matter how arbitrarily deep you nest
  132. your sub forms. You need do nothing to benefit from this; this
  133. behaviour is enabled by default.
  134. </para>
  135. <para>
  136. Additionally, there are facilities that allow you to turn on array
  137. notation conditionally, as well as specify the specific array to
  138. which an element or collection belongs:
  139. </para>
  140. <itemizedlist>
  141. <listitem>
  142. <para>
  143. <methodname>Zend_Form::setIsArray($flag)</methodname>: By setting the
  144. flag <constant>TRUE</constant>, you can indicate that an entire form should be
  145. treated as an array. By default, the form's name will be
  146. used as the name of the array, unless
  147. <methodname>setElementsBelongTo()</methodname> has been called. If the
  148. form has no specified name, or if
  149. <methodname>setElementsBelongTo()</methodname> has not been set, this
  150. flag will be ignored (as there is no array name to which
  151. the elements may belong).
  152. </para>
  153. <para>
  154. You may determine if a form is being treated as an array
  155. using the <methodname>isArray()</methodname> accessor.
  156. </para>
  157. </listitem>
  158. <listitem>
  159. <para>
  160. <methodname>Zend_Form::setElementsBelongTo($array)</methodname>:
  161. Using this method, you can specify the name of an array to
  162. which all elements of the form belong. You can determine the
  163. name using the <methodname>getElementsBelongTo()</methodname> accessor.
  164. </para>
  165. </listitem>
  166. </itemizedlist>
  167. <para>
  168. Additionally, on the element level, you can specify individual
  169. elements may belong to particular arrays using
  170. <methodname>Zend_Form_Element::setBelongsTo()</methodname> method.
  171. To discover what this value is -- whether set explicitly or
  172. implicitly via the form -- you may use the
  173. <methodname>getBelongsTo()</methodname> accessor.
  174. </para>
  175. </sect2>
  176. <sect2 id="zend.form.advanced.multiPage">
  177. <title>Multi-Page Forms</title>
  178. <para>
  179. Currently, Multi-Page forms are not officially supported in
  180. <classname>Zend_Form</classname>; however, most support for implementing them
  181. is available and can be utilized with a little extra tooling.
  182. </para>
  183. <para>
  184. The key to creating a multi-page form is to utilize sub forms, but
  185. to display only one such sub form per page. This allows you to
  186. submit a single sub form at a time and validate it, but not process
  187. the form until all sub forms are complete.
  188. </para>
  189. <example id="zend.form.advanced.multiPage.registration">
  190. <title>Registration Form Example</title>
  191. <para>
  192. Let's use a registration form as an example. For our purposes,
  193. we want to capture the desired username and password on the
  194. first page, then the user's metadata -- given name, family name,
  195. and location -- and finally allow them to decide what mailing
  196. lists, if any, they wish to subscribe to.
  197. </para>
  198. <para>
  199. First, let's create our own form, and define several sub forms
  200. within it:
  201. </para>
  202. <programlisting language="php"><![CDATA[
  203. class My_Form_Registration extends Zend_Form
  204. {
  205. public function init()
  206. {
  207. // Create user sub form: username and password
  208. $user = new Zend_Form_SubForm();
  209. $user->addElements(array(
  210. new Zend_Form_Element_Text('username', array(
  211. 'required' => true,
  212. 'label' => 'Username:',
  213. 'filters' => array('StringTrim', 'StringToLower'),
  214. 'validators' => array(
  215. 'Alnum',
  216. array('Regex',
  217. false,
  218. array('/^[a-z][a-z0-9]{2,}$/'))
  219. )
  220. )),
  221. new Zend_Form_Element_Password('password', array(
  222. 'required' => true,
  223. 'label' => 'Password:',
  224. 'filters' => array('StringTrim'),
  225. 'validators' => array(
  226. 'NotEmpty',
  227. array('StringLength', false, array(6))
  228. )
  229. )),
  230. ));
  231. // Create demographics sub form: given name, family name, and
  232. // location
  233. $demog = new Zend_Form_SubForm();
  234. $demog->addElements(array(
  235. new Zend_Form_Element_Text('givenName', array(
  236. 'required' => true,
  237. 'label' => 'Given (First) Name:',
  238. 'filters' => array('StringTrim'),
  239. 'validators' => array(
  240. array('Regex',
  241. false,
  242. array('/^[a-z][a-z0-9., \'-]{2,}$/i'))
  243. )
  244. )),
  245. new Zend_Form_Element_Text('familyName', array(
  246. 'required' => true,
  247. 'label' => 'Family (Last) Name:',
  248. 'filters' => array('StringTrim'),
  249. 'validators' => array(
  250. array('Regex',
  251. false,
  252. array('/^[a-z][a-z0-9., \'-]{2,}$/i'))
  253. )
  254. )),
  255. new Zend_Form_Element_Text('location', array(
  256. 'required' => true,
  257. 'label' => 'Your Location:',
  258. 'filters' => array('StringTrim'),
  259. 'validators' => array(
  260. array('StringLength', false, array(2))
  261. )
  262. )),
  263. ));
  264. // Create mailing lists sub form
  265. $listOptions = array(
  266. 'none' => 'No lists, please',
  267. 'fw-general' => 'Zend Framework General List',
  268. 'fw-mvc' => 'Zend Framework MVC List',
  269. 'fw-auth' => 'Zend Framwork Authentication and ACL List',
  270. 'fw-services' => 'Zend Framework Web Services List',
  271. );
  272. $lists = new Zend_Form_SubForm();
  273. $lists->addElements(array(
  274. new Zend_Form_Element_MultiCheckbox('subscriptions', array(
  275. 'label' =>
  276. 'Which lists would you like to subscribe to?',
  277. 'multiOptions' => $listOptions,
  278. 'required' => true,
  279. 'filters' => array('StringTrim'),
  280. 'validators' => array(
  281. array('InArray',
  282. false,
  283. array(array_keys($listOptions)))
  284. )
  285. )),
  286. ));
  287. // Attach sub forms to main form
  288. $this->addSubForms(array(
  289. 'user' => $user,
  290. 'demog' => $demog,
  291. 'lists' => $lists
  292. ));
  293. }
  294. }
  295. ]]></programlisting>
  296. <para>
  297. Note that there are no submit buttons, and that we have done
  298. nothing with the sub form decorators -- which means that by
  299. default they will be displayed as fieldsets. We will need to be
  300. able to override these as we display each individual sub form,
  301. and add in submit buttons so we can actually process them --
  302. which will also require action and method properties. Let's add
  303. some scaffolding to our class to provide that information:
  304. </para>
  305. <programlisting language="php"><![CDATA[
  306. class My_Form_Registration extends Zend_Form
  307. {
  308. // ...
  309. /**
  310. * Prepare a sub form for display
  311. *
  312. * @param string|Zend_Form_SubForm $spec
  313. * @return Zend_Form_SubForm
  314. */
  315. public function prepareSubForm($spec)
  316. {
  317. if (is_string($spec)) {
  318. $subForm = $this->{$spec};
  319. } elseif ($spec instanceof Zend_Form_SubForm) {
  320. $subForm = $spec;
  321. } else {
  322. throw new Exception('Invalid argument passed to ' .
  323. __FUNCTION__ . '()');
  324. }
  325. $this->setSubFormDecorators($subForm)
  326. ->addSubmitButton($subForm)
  327. ->addSubFormActions($subForm);
  328. return $subForm;
  329. }
  330. /**
  331. * Add form decorators to an individual sub form
  332. *
  333. * @param Zend_Form_SubForm $subForm
  334. * @return My_Form_Registration
  335. */
  336. public function setSubFormDecorators(Zend_Form_SubForm $subForm)
  337. {
  338. $subForm->setDecorators(array(
  339. 'FormElements',
  340. array('HtmlTag', array('tag' => 'dl',
  341. 'class' => 'zend_form')),
  342. 'Form',
  343. ));
  344. return $this;
  345. }
  346. /**
  347. * Add a submit button to an individual sub form
  348. *
  349. * @param Zend_Form_SubForm $subForm
  350. * @return My_Form_Registration
  351. */
  352. public function addSubmitButton(Zend_Form_SubForm $subForm)
  353. {
  354. $subForm->addElement(new Zend_Form_Element_Submit(
  355. 'save',
  356. array(
  357. 'label' => 'Save and continue',
  358. 'required' => false,
  359. 'ignore' => true,
  360. )
  361. ));
  362. return $this;
  363. }
  364. /**
  365. * Add action and method to sub form
  366. *
  367. * @param Zend_Form_SubForm $subForm
  368. * @return My_Form_Registration
  369. */
  370. public function addSubFormActions(Zend_Form_SubForm $subForm)
  371. {
  372. $subForm->setAction('/registration/process')
  373. ->setMethod('post');
  374. return $this;
  375. }
  376. }
  377. ]]></programlisting>
  378. <para>
  379. Next, we need to add some scaffolding in our action controller,
  380. and have several considerations. First, we need to make sure we
  381. persist form data between requests, so that we can determine
  382. when to quit. Second, we need some logic to determine what form
  383. segments have already been submitted, and what sub form to
  384. display based on that information. We'll use
  385. <classname>Zend_Session_Namespace</classname> to persist data, which will
  386. also help us answer the question of which form to submit.
  387. </para>
  388. <para>
  389. Let's create our controller, and add a method for retrieving a
  390. form instance:
  391. </para>
  392. <programlisting language="php"><![CDATA[
  393. class RegistrationController extends Zend_Controller_Action
  394. {
  395. protected $_form;
  396. public function getForm()
  397. {
  398. if (null === $this->_form) {
  399. $this->_form = new My_Form_Registration();
  400. }
  401. return $this->_form;
  402. }
  403. }
  404. ]]></programlisting>
  405. <para>
  406. Now, let's add some functionality for determining which form to
  407. display. Basically, until the entire form is considered valid,
  408. we need to continue displaying form segments. Additionally, we
  409. likely want to make sure they're in a particular order: user,
  410. demog, and then lists. We can determine what data has been
  411. submitted by checking our session namespace for particular keys
  412. representing each subform.
  413. </para>
  414. <programlisting language="php"><![CDATA[
  415. class RegistrationController extends Zend_Controller_Action
  416. {
  417. // ...
  418. protected $_namespace = 'RegistrationController';
  419. protected $_session;
  420. /**
  421. * Get the session namespace we're using
  422. *
  423. * @return Zend_Session_Namespace
  424. */
  425. public function getSessionNamespace()
  426. {
  427. if (null === $this->_session) {
  428. $this->_session =
  429. new Zend_Session_Namespace($this->_namespace);
  430. }
  431. return $this->_session;
  432. }
  433. /**
  434. * Get a list of forms already stored in the session
  435. *
  436. * @return array
  437. */
  438. public function getStoredForms()
  439. {
  440. $stored = array();
  441. foreach ($this->getSessionNamespace() as $key => $value) {
  442. $stored[] = $key;
  443. }
  444. return $stored;
  445. }
  446. /**
  447. * Get list of all subforms available
  448. *
  449. * @return array
  450. */
  451. public function getPotentialForms()
  452. {
  453. return array_keys($this->getForm()->getSubForms());
  454. }
  455. /**
  456. * What sub form was submitted?
  457. *
  458. * @return false|Zend_Form_SubForm
  459. */
  460. public function getCurrentSubForm()
  461. {
  462. $request = $this->getRequest();
  463. if (!$request->isPost()) {
  464. return false;
  465. }
  466. foreach ($this->getPotentialForms() as $name) {
  467. if ($data = $request->getPost($name, false)) {
  468. if (is_array($data)) {
  469. return $this->getForm()->getSubForm($name);
  470. break;
  471. }
  472. }
  473. }
  474. return false;
  475. }
  476. /**
  477. * Get the next sub form to display
  478. *
  479. * @return Zend_Form_SubForm|false
  480. */
  481. public function getNextSubForm()
  482. {
  483. $storedForms = $this->getStoredForms();
  484. $potentialForms = $this->getPotentialForms();
  485. foreach ($potentialForms as $name) {
  486. if (!in_array($name, $storedForms)) {
  487. return $this->getForm()->getSubForm($name);
  488. }
  489. }
  490. return false;
  491. }
  492. }
  493. ]]></programlisting>
  494. <para>
  495. The above methods allow us to use notations such as "<command>$subForm =
  496. $this-&gt;getCurrentSubForm();</command>" to retrieve the current
  497. sub form for validation, or "<command>$next =
  498. $this-&gt;getNextSubForm();</command>" to get the next one to
  499. display.
  500. </para>
  501. <para>
  502. Now, let's figure out how to process and display the various sub
  503. forms. We can use <methodname>getCurrentSubForm()</methodname> to determine
  504. if any sub forms have been submitted (<constant>FALSE</constant> return values
  505. indicate none have been displayed or submitted), and
  506. <methodname>getNextSubForm()</methodname> to retrieve a form to display. We
  507. can then use the form's <methodname>prepareSubForm()</methodname> method to
  508. ensure the form is ready for display.
  509. </para>
  510. <para>
  511. When we have a form submission, we can validate the sub form,
  512. and then check to see if the entire form is now valid. To do
  513. these tasks, we'll need additional methods that ensure that
  514. submitted data is added to the session, and that when validating
  515. the form entire, we validate against all segments from the
  516. session:
  517. </para>
  518. <programlisting language="php"><![CDATA[
  519. class RegistrationController extends Zend_Controller_Action
  520. {
  521. // ...
  522. /**
  523. * Is the sub form valid?
  524. *
  525. * @param Zend_Form_SubForm $subForm
  526. * @param array $data
  527. * @return bool
  528. */
  529. public function subFormIsValid(Zend_Form_SubForm $subForm,
  530. array $data)
  531. {
  532. $name = $subForm->getName();
  533. if ($subForm->isValid($data)) {
  534. $this->getSessionNamespace()->$name = $subForm->getValues();
  535. return true;
  536. }
  537. return false;
  538. }
  539. /**
  540. * Is the full form valid?
  541. *
  542. * @return bool
  543. */
  544. public function formIsValid()
  545. {
  546. $data = array();
  547. foreach ($this->getSessionNamespace() as $key => $info) {
  548. $data[$key] = $info;
  549. }
  550. return $this->getForm()->isValid($data);
  551. }
  552. }
  553. ]]></programlisting>
  554. <para>
  555. Now that we have the legwork out of the way, let's build the
  556. actions for this controller. We'll need a landing page for the
  557. form, and then a 'process' action for processing the form.
  558. </para>
  559. <programlisting language="php"><![CDATA[
  560. class RegistrationController extends Zend_Controller_Action
  561. {
  562. // ...
  563. public function indexAction()
  564. {
  565. // Either re-display the current page, or grab the "next"
  566. // (first) sub form
  567. if (!$form = $this->getCurrentSubForm()) {
  568. $form = $this->getNextSubForm();
  569. }
  570. $this->view->form = $this->getForm()->prepareSubForm($form);
  571. }
  572. public function processAction()
  573. {
  574. if (!$form = $this->getCurrentSubForm()) {
  575. return $this->_forward('index');
  576. }
  577. if (!$this->subFormIsValid($form,
  578. $this->getRequest()->getPost())) {
  579. $this->view->form = $this->getForm()->prepareSubForm($form);
  580. return $this->render('index');
  581. }
  582. if (!$this->formIsValid()) {
  583. $form = $this->getNextSubForm();
  584. $this->view->form = $this->getForm()->prepareSubForm($form);
  585. return $this->render('index');
  586. }
  587. // Valid form!
  588. // Render information in a verification page
  589. $this->view->info = $this->getSessionNamespace();
  590. $this->render('verification');
  591. }
  592. }
  593. ]]></programlisting>
  594. <para>
  595. As you'll notice, the actual code for processing the form is
  596. relatively simple. We check to see if we have a current sub form
  597. submission, and if not, we go back to the landing page. If we do
  598. have a sub form, we attempt to validate it, redisplaying it if
  599. it fails. If the sub form is valid, we then check to see if the
  600. form is valid, which would indicate we're done; if not, we
  601. display the next form segment. Finally, we display a
  602. verification page with the contents of the session.
  603. </para>
  604. <para>
  605. The view scripts are very simple:
  606. </para>
  607. <programlisting language="php"><![CDATA[
  608. <?php // registration/index.phtml ?>
  609. <h2>Registration</h2>
  610. <?php echo $this->form ?>
  611. <?php // registration/verification.phtml ?>
  612. <h2>Thank you for registering!</h2>
  613. <p>
  614. Here is the information you provided:
  615. </p>
  616. <?
  617. // Have to do this construct due to how items are stored in session
  618. // namespaces
  619. foreach ($this->info as $info):
  620. foreach ($info as $form => $data): ?>
  621. <h4><?php echo ucfirst($form) ?>:</h4>
  622. <dl>
  623. <?php foreach ($data as $key => $value): ?>
  624. <dt><?php echo ucfirst($key) ?></dt>
  625. <?php if (is_array($value)):
  626. foreach ($value as $label => $val): ?>
  627. <dd><?php echo $val ?></dd>
  628. <?php endforeach;
  629. else: ?>
  630. <dd><?php echo $this->escape($value) ?></dd>
  631. <?php endif;
  632. endforeach; ?>
  633. </dl>
  634. <?php endforeach;
  635. endforeach ?>
  636. ]]></programlisting>
  637. <para>
  638. Upcoming releases of Zend Framework will include components to
  639. make multi page forms simpler by abstracting the session and
  640. ordering logic. In the meantime, the above example should serve
  641. as a reasonable guideline on how to accomplish this task for
  642. your site.
  643. </para>
  644. </example>
  645. </sect2>
  646. </sect1>
  647. <!--
  648. vim:se ts=4 sw=4 et:
  649. -->