开发者

Multidimensional Array based Elements

开发者 https://www.devze.com 2023-01-08 01:19 出处:网络
Using Zend_Form, how would I create form ele开发者_运维问答ments like this <input type=\"text\" name=\"element[1]\" value=\"\"/>

Using Zend_Form, how would I create form ele开发者_运维问答ments like this

<input type="text" name="element[1]" value=""/>
<input type="text" name="element[2]" value=""/>


Use a SubForm:

$form = new Zend_Form;
$subForm = new Zend_Form_SubForm('SubForm', 'element');
$subForm->addElements(array(
    $subForm->createElement('Text', '0'),
    $subForm->createElement('Text', '1'),
));
$form->addSubForm($subForm, 'element');

I'm sure this can be written with array notation somehow too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号