views:

2283

answers:

3

I would like to go about creating a multi-page form that changes based on options that are selected on previous pages of the form.

I want to use Zend_Form, and I know JavaScript will be in charge of making the different form fields appear/disappear, but I don't know how the two will work together exactly.

My question is how to get started creating this kind of form with Zend_Form and JavaScript? I am familiar with jQuery, so if there is a jQuery plugin that helps with this, let me know.

+1  A: 

I you're going to create a spruced-up multipage form that does all kinds of neat tricks, I would not suggest using Zend_Form, as it will probably just get in your way, but that's just my opinion. I use the Zend Framework, but I never saw the need to use Zend Form, as I like coding everything form related myself.

I would build the form in plain-old HTML, you could use the jQuery tabs plugin to divide the form up into pages in a sleeker way, and the jQuery form plugin to assist with serialization of the form and ajax submission.

There's also the jQuery validation plugin, but I've never tried it out.

Good luck with that.

karim79
Zend_Form will save a huge amount of time with filtering, validating and reporting back errors. Unless you want highly customised functionality you should use it
David Caunt
dcaunt - generally I do, such as multilingual forms with custom ajax widgets and such. Much easier having complete control of everything.
karim79
A: 

If you want to use JavaScript i would highly recommend the jQuery wizard plugin. It supports branching and validation.

A: 

I agree with jquery comments, in that if you're familiar with it, I'm pretty sure theres a zend hookup with jquery.

That being said, if you can avoid breaking the form up onto multiple physically different pages, just have them logically separated, ie: reload data in a div(or tabs as karim mentioned), etc, so that you can maintain all the info being tracked in the form. If you must have physically separated pages, you can use sessions to store the persistent data.

This may help you to start out with, though I don't know your exact zend setup: http://framework.zend.com/manual/en/zendx.jquery.form.html

brack