I want to append group's name into element's name the same way sub form appends its name. If I add a subform named 'basicDetails' and add a text field 'firstName' into the sub form the code will be something <input type="text" value="" id="basicDetails-firstName" name="basicDetails[firstName]" /> Code (markup): I want to achieve the same with groups so if I add a group 'personalInformation' in the subform and add the 'firstName' element into this group, ZF generate <input type="text" value="" id="basicDetails-personalInformation-firstName" name="basicDetails[personalInformation][firstName]" /> Code (markup): any suggestions
Why not generate another subform instead of a group, since they both use fieldset decorator and Zend supports nested subforms? $form = new Zend_Form(); $form->addElement('Text','username'); $sForm = new Zend_Form_SubForm(); $sForm->addElement('Text','email'); $form->addSubForm($sForm, 'basicDetails'); $ssForm = new Zend_Form_SubForm(); $ssForm->addElement('Text','firstName'); $sForm->addSubForm($ssForm, 'personalInformation'); echo $form->render(); PHP: