B
B
bahek24627742014-02-06 02:05:11
Zend Framework
bahek2462774, 2014-02-06 02:05:11

Zend Framework 2: How to generate multiple selects on a form?

Point in the right direction. It is necessary to generate many select-ov in the form.
For example

<select name="cat[1]">
  <option value="1">1</option>
  <option value="2">2</option>
</select>
<select name="cat[2]">
  <option value="1">1</option>
  <option value="2">2</option>
</select>
<select name="cat[3]">
  <option value="1">1</option>
  <option value="2">2</option>
</select>

To add that, for example, I can them after creation of object of the form. But how do I then process these generated elements in the InputFilter? I do not know in advance the number of elements in the cat array.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shirshov Alexander, 2014-02-06
@bahek2462774

Zend\Form\Element\Collection to help you. zf2.com.ua/doc/162

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question