If you want building[streetNumber]
then you don't want to use a Fieldset. That's really all there is to it. A Zend\Form\Fieldset
is an Element that encapsulates a set of properties that are standalone / their own object. For example:
Table Buildings
- id
- attr1
- addr_id
Table Addresses
- id
- name
- nr
In this case you'd have an AddressFieldset
. But this isn't what you want. I assume you only divided this into fieldsets to have an impact on the default rendering. This is a mis-use of Zend\Form\Fieldset
. You simply will have to render your form differently like
echo $this->form()->openTag($form);
echo "<fieldset>
";
echo " <legend>Address</legend>
";
echo $this->formRow($form->get('streetName'));
echo $this->formRow($form->get('streetNuber'));
echo "</fieldset>
";
echo "<fieldset>
";
echo " <legend>Features</legend>
";
echo $this->formRow($form->get('levelCount'));
echo $this->formRow($form->get('height'));
echo "</fieldset>
";
echo $this->form()->closeTag();