我想渲染:
<input type="text" value="" name="foo[]" />
<input type="text" value="" name="bar[]" />
Run Code Online (Sandbox Code Playgroud)
但是Zend_Form_Element需要一个(字符串)名称,所以我需要这样做:
$this->addElement('text', '1', array(
'belongsTo' => 'foo'
));
$this->addElement('text', '2', array(
'belongsTo' => 'bar'
));
Run Code Online (Sandbox Code Playgroud)
但输出是:
<input id="foo-1" type="text" value="" name="foo[1]" />
<input id="bar-2" type="text" value="" name="bar[2]" />
Run Code Online (Sandbox Code Playgroud)
我也可以接受如下输出:
<input id="foo-1" type="text" value="" name="foo[1]" />
<input id="bar-1" type="text" value="" name="bar[1]" />
Run Code Online (Sandbox Code Playgroud)
但Zend_Form_Element重写了同名的元素
有办法做我需要的吗?