本文介绍了Zend Form和嵌套的字段集/容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表格。我只有一个元素,需要包装在div或fieldset中(用于格式化)。然后,我想将两组元素(包括上述元素)包装在字段集或div中。我设法创建了两个组,但是Zend Form似乎不愿让我创建一个包含一个组的组。我应该能够做到这一点吗?
I have a form. I have a single element that needs to be wrapped in a div or fieldset (for formatting). Then I have two groups of elements, including the above, that I want to wrap in a fieldset or div. I've managed to create two groups, but Zend Form seems to balk at letting me create a group containing a group. Should I be able to do this?
这里是一个简单的代码示例,假设我已经创建了elem1,elem2和elem3。
Here's a simple code example, assuming I have created elem1, elem2 and elem3.
$form->addDisplayGroup(array('elem1'), 'group1', array("legend" => "Wrapped element"));
$form->addDisplayGroup(array('group1', 'elem2', 'elem3'), 'group2', array("legend" => "All elements"));
推荐答案
嵌套组-不,:(但是您可以使用子表单
Nasted groups - nope :( but you can use subforms.
这篇关于Zend Form和嵌套的字段集/容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!