view - Zend framework 2 loop through elements of element collection -


i created collection of inputs zend\form\element\collection, like

 $this->add([         'type' => 'zend\form\element\collection',         'name' => 'some-name',         'options' => [             'label' => 'some name',             'count' => 3,             'target_element' => [                 'type' => 'text',             ],         ],     ]); 

this codes renders 3 inputs label , fieldset if use

echo $this->formcollection($form->get('some-name')); 

(or of formcollection) in view script.

i want wrap each input of collection divs. idea iterate on input collection extract inputs.

how can this?

you can treat collection traversable object.

<?php foreach ($form->get('some-name') $element) : ?>   <div>..</div> <?php endforeach; ?> 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -