tread
tread

Reputation: 11098

Grouping Form Zend not posting Data of Second Form?

I have 2 Forms, which I am usingain another form to try and keep things DRY.

In this manner:

#Forms/my_form.php
$this->addSubForm(new Form_thisForm(), 'this form');
$this->addSubForm(new Form_thatForm(), 'that form');

//then i add 2 more elements a sort and order element
//then a submit

So in the view where the form is used, all the fields show from all forms included. However when posting the form data only the fields from Form_thisForm() and the Form_myForm(), ie. the main form, are posting. Data or form element names are not posting from Form_thatForm().

The post only contains variables in the 1st subform and full form. Not the second subform.

Upvotes: 2

Views: 61

Answers (1)

Max Ivanov
Max Ivanov

Reputation: 6561

I guess your Form_thisForm and Form_thatForm are inherited from Zend_Form, so they also have Form decorator (which basically wraps your subforms in <form> tag). As a result you have nested <form> tags in your html and this is not valid.

You should inherit your subforms classes from Zend_Form_SubForm - it has no Form decorator by default.

Upvotes: 2

Related Questions