开发者

Need help with Zend Multiple page Sub Form

Currently working with Zend Sub form in Zend framework to achieve Multi page form.

This is the example i'm using at the moment

http://framework.zend.com/manual/en/zend.form.advanced.html

Managed to get everything working nicely but I wanted to have a 'Back' button on the forms so when the users press on the “back” button the previous form will re display with entered data.

I'm wondering is there any tutorial on the net teaches this or 开发者_StackOverflowis it easy to code this functionality?

Thank you so much. PS I Love stackoverflow community :)!


Its a structuring and naming thing.

I'm going to psuedo-code and talk you through this, let me know if you need me to type out a full example

Assumption:
MultiPageForm has many SubForms that represent pages.
when you add these subforms to the parent form you name them something intelligent.

so for example, if your form was at /register, use an optional url paramater */register/page/{that_intelligent_subform_name_from_before}* to build out a navigation

<ul>
  <li><a href="/register/page/step1">Step 1</a></li>
  <li><a href="/register/page/step2">Step 2</a></li>
  <li><a href="/register/page/step3">Step 3</a></li>
</ul>

then in your controller:
1. pull out the page param
2. fetch the subform with that name from the multipage form
3. prepopulate the subform
4. send the subform to the view

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜