Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php zend form多复选框命名_Php_Zend Framework - Fatal编程技术网

Php zend form多复选框命名

Php zend form多复选框命名,php,zend-framework,Php,Zend Framework,我必须如何嵌套多复选框,以便它们的名称类似于“foo[]['bar']” 我使用过子表单,但它们给我的命名是这样的“foo[bar][]” 我的代码: $sub=新的Zend_表单_子表单(“sub”) $wish=新Zend_Form_Element_MultiCheckbox('bar') $wish ->setMultiOptions($education_direction->getAll()) ->setLabel('Wish') ->setRequir

我必须如何嵌套多复选框,以便它们的名称类似于“foo[]['bar']”

我使用过子表单,但它们给我的命名是这样的“foo[bar][]”

我的代码:

$sub=新的Zend_表单_子表单(“sub”)

$wish=新Zend_Form_Element_MultiCheckbox('bar')

$wish

->setMultiOptions($education_direction->getAll())
->setLabel('Wish')    
->setRequired(true);
$sub->addElements(数组)( $wish ));

$this->addSubForm($sub,'foo')


我认为您正在为Zend表单元素寻找“belongsTo”选项

如果你需要一些东西,比如:

尝试:


令人惊叹的。我已经设置了'belongsTo'=>'foo[],并且我得到的字段名是'foo[]['field1]'。工作起来很有魅力。非常感谢:)
$this->addElement(
         'text', 'field1', 
            array(
             'label'     => 'field',
             'belongsTo' => 'foo'
        ));