ZF-10333: Zend_Form_Element::setBelongsTo() must override Zend_Form::setElementsBelongTo() individualy
Description
When I create a form using array notation, some elements should not follow the rule from the main form. For example:
$form = new Zend_Form;
$form->setElementsBelongTo('Foo');
$form->addElement('text', 'name');
$form->addElement('text', 'email');
$form->addElement('text', 'Bar', array('belongsTo' => 'subInfo'));
The output is:
While the correct output (because setBelongsTo() was called individualy) is:
Comments
Posted by Marc Hodgins (mjh_ca) on 2010-10-25T17:21:41.000+0000
From the docs:
??Zend_Form::setElementsBelongTo($array): Using this method, you can specify the name of an array to which all elements of the form belong.??
So by definition setElementsBelongTo() is intended to override individual elements.
Posted by Daniel Lima (yourwebmaker) on 2010-11-19T04:42:59.000+0000
I disagree,
So... if I need to use a ::subForm() or setBelongsTo() I can't set a particular name for my element?
If I am using a form that maps a model to be saved I can't use it.
I think that element renderization must be individual.
Posted by Ralph Schindler (ralph) on 2010-11-19T09:27:31.000+0000
I am re-opening so that I can further investigate this as per a conversation I've had with [~guilhermeblanco]
Posted by victor Velkov (vigor_bg) on 2011-01-13T06:47:44.000+0000
I do agree as well with Daniel.
Actually at the moment it is hindering my work as i have few forms that need only one element to be with different belongsTo and in order for it to work I need to set it to all elements separately instead of set it for the form and then just to set it for that specific element that require it.
So I will appreciate it if anyone post an update to what are you going to decide regarding that matter. :)
PS.: The framework is great keep up the good work :)