so basically I figured it out.
create empty subforms first
$left = new Zend_Form_SubForm();
then you add the subforms you want inside this "subform"
$left->setSubForms(array( 'sub1' => $sub1, 'sub2' => $sub2 ));
you do the same for the other subform you want to add decorators to.
$right = new Zend_Form_SubForm(); $right->setSubForms(array( 'sub3' => $sub3, 'sub4' => $sub4 ));
then in your original form you add these new "$ left" and "$ right" subforms
$this->setSubForms(array( 'left' => $left, 'right' => $right ));
you can then apply the decorators to the subforms "$ left" and "$ right", as you wish.
since I want to remove fields that encapsulate elements inside my view looks like this, you do the same with the other.
$left->setDecorators(array( 'FormElements', array('HtmlTag', array('tag' => 'div')), ));
thanks
James yun
source share