|
|||
|
Hello,
i'm looking for a quick&clean way (i'm asking too much.. i know ) to handle multipage forms. Since the Zend_Form component is still not fully complete (File Upload and Multi Page support are missing) i can't figure out finding a way to handle them without repeating much code. I tried to implement that code listed on the tutorial, but i found it incorrect, as there's some code which should go in the controller and not in the class extending zend_form or viceversa, and leads to a very tedious process in my case where i need different forms of this kind. At this point i will make a step back and move out of zend_form component until is 100% complete. Could you please post some examples (or links) on form handling without zend_form? Any help is appreciated. Thanks. |
|
|||
|
Hello,
Since i haven't found any solution to my issue, i managed to write something by myself. ![]() I wrote an external extensible class, which provides (or tries to do so) the following features: - Simple multi page form handling (all forms are extensions of my class) - Data persistence using sessions - Arbitrary step retrieving (in case you would edit some previous submitted step) - Data validation/filtering for each step - Stored data retrieving/deleting for each step But does NOT (yet?) provide the following: - Multi instance form handling (when the user opens multiple instances of the same form, using tabs for example, this uses the same session.. can't find a workaround for this) - Conditional step retrieving (i don't need this, at the moment, neither i've got any idea on how implement this) - Something else ![]() Dependencies: - Zend Framework version 1.5.1 - Zend_Form_* - Zend_Session_* - Zend_Controller_Request_Http Here's a code snippet from my controller, just to let you see how it works: PHP Code:
Just a little disclaimer: Quote:
Last edited by MiK : 04-10-2008 at 01:37 PM. |
|
|||
|
Hello,
I'm also trying to use multi page forms with Zend_Form following the tutorial but as you said it's wrong at some points. I think your code looks nice so, if it really works I'm interested on it. So, could you reply with the whole code? You know: controller, form class and view (.phtml files). It'd help me a lot ![]() Thanks and good job!! |
|
|||
|
Thanks for your interest.
Since i'm currently still developing the class, i don't have a "STABLE" release. Please allow a couple of days in order to let me build a working example, and so i will post the complete code as attachment here. One of my last edit was the ability to fetch an array of a subform elements ( Multipage_Form::getStepElements() ) in order to pass it directly to the view, and without being limited by zend_form decorators behaviour. Something like: PHP Code:
HTML Code:
<table> <tr> <td>{$form.field1->getLabel()}</td> <td>{$form.field1}</td> <tr> <td colspan="2">{$form.submit}</td> </tr> </table> |
|
|||
|
Finally i got it...
I created a little zend framework enviroment with a couple of very simple examples. Just copy the ZF libraries to /library/Zend and you're ready. The class is located in /library/Form All the forms are in /application/forms Download: MultiPage_Form_with_Examples.zip Class Documentation: MultiPage_Form_PhpDoc.zip Last edited by MiK : 04-12-2008 at 08:50 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|