Shaun Farrell wrote:
Question about multi page forms using subforms.
Ok so I have been looking at the example on
http://framework.zend.com/manual/en/zend.form.advanced.html#zend.form.advanced.multiPage
<http://framework.zend.com/manual/en/zend.form.advanced.html#zend.form.advanced.multiPage%20>which
is all good.
Hi there,
I've been doing this differently. I define the subforms as classes:
My_Subform_1, My_Subform_2 and so on. I display each form on one page. I
keep track of validated subforms via session vars and redirect to
previous subform if is not validated yet. On the last page I have a
master form that consists of all subforms:
class Master_Form extends Zend_Form {
public function init()
{
$this->addSubForm(new My_Subform_1, 'subform1');
$this->addSubForm(new My_Subform_2, 'subform2');
// and so on
}
}
This one I validate as whole again and then use the values.
Unfortunately, this uses quite a bit of controller logic, but that is
okay with me and works just fine.
Cheers Jan