【问题标题】:is it possible to create subform and displaygroup without fieldset on zend forms?是否可以在 zend 表单上创建没有字段集的子表单和显示组?
【发布时间】:2011-01-31 13:35:02
【问题描述】:

是否可以在 zend 表单上创建没有字段集的子表单和显示组?

【问题讨论】:

    标签: zend-framework zend-form zend-form-sub-form


    【解决方案1】:

    是的,这是可能的。

    您可以像这样在您的特定表单中覆盖 loadDefaultDecorators Zend_Form 原始方法:

    public function loadDefaultDecorators() {
        parent::loadDefaultDecorators();
    
        // remove the 'fieldset' decorator from all subforms
        $subforms = $this->getSubForms();
        foreach($subforms as $subform) {
            $subform->removeDecorator('Fieldset');
        }
    
        return $this;
    }
    

    当您基于例如从选择列表中选择的选项动态加载子表单时,这可能会有所帮助。 希望这会对某人有所帮助。

    【讨论】:

      【解决方案2】:

      为什么要这样做?
      这是有用的辅助功能吗?

      但是,您可以通过多种方式执行此操作,例如继承 Zend_Form 并设置自己的装饰器,或使用 getDecorators()addDecorator() setDecorators()removeDecorator() 方法。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-09-18
        • 2012-04-16
        • 2018-04-19
        • 2018-10-02
        • 1970-01-01
        相关资源
        最近更新 更多