Zend framework Zend_表单元素复选框问题

Zend framework Zend_表单元素复选框问题,zend-framework,zend-form,Zend Framework,Zend Form,我想使用Zend_Form_Element_复选框实现示例html标记。但是,遇到问题,例如页面操作[]。我希望将其放在属性中,并在请求中接收数组。我知道我必须在表单的init中完成,但我缺乏Zend框架的知识。我试过几种选择。例如,这: // In for loop in init method $element = new Zend_Form_Element_Checkbox('test['.$i.']'); $element->setIsArray(true)->setBelo

我想使用Zend_Form_Element_复选框实现示例html标记。但是,遇到问题,例如页面操作[]。我希望将其放在属性中,并在请求中接收数组。我知道我必须在表单的init中完成,但我缺乏Zend框架的知识。我试过几种选择。例如,这:

// In for loop in init method
$element = new Zend_Form_Element_Checkbox('test['.$i.']');
$element->setIsArray(true)->setBelongsTo('checkbox_name');
$this->addElement($element);
这是我想要实现的标记:-

<div>
    <div>
        Some bold message for this group
    </div>
    <div>
        <span>
            <input type="checkbox" id="qf_18" value="12" name="page_actions[]"/><label for="qf_18">Test 18</label><br/>
            <input type="checkbox" id="qf_20" value="13" name="page_actions[]"/><label for="qf_20">Test 20</label><br/>
            <input type="checkbox" id="qf_22" value="14" name="page_actions[]"/><label for="qf_22">Test 22</label><br/>
            <input type="checkbox" id="qf_24" value="15" name="page_actions[]"/><label for="qf_24">Test 24</label><br/>
            <input type="checkbox" id="qf_26" value="16" name="page_actions[]"/><label for="qf_26">Test 26</label>
        </span>
    </div>
</div>
<div>
    <div style="font-weight: bold;">
        Some bold message for this other group
    </div>
    <div>
        <span>
            <input type="checkbox" id="qf_28" value="17" name="page_actions[]"/><label for="qf_28">Test 28</label><br/>
            <input type="checkbox" id="qf_30" value="18" name="page_actions[]"/><label for="qf_30">Test 30</label><br/>
            <input type="checkbox" id="qf_32" value="19" name="page_actions[]"/><label for="qf_32">Test 32</label><br/>
            <input type="checkbox" id="qf_34" value="20" name="page_actions[]"/><label for="qf_34">Test 34</label><br/>
            <input type="checkbox" id="qf_36" value="21" name="page_actions[]"/><label for="qf_36">Test 35</label>
        </span>
    </div>
</div>

您可以使用视图脚本来执行此操作。我认为zend form decorator不支持这种形式

与其提供太多的代码,不如提供PHP代码、实际HTML输出和预期HTML输出。请看这个答案,它将为您指明正确的方向。