【问题标题】:Zend Form Checkbox Element customizationZend 表单复选框元素自定义
【发布时间】:2023-04-07 06:47:01
【问题描述】:

我有一个带有一些元素的 zend 表单,包括一个复选框。 看起来很正常:

checkbox label []

我想在右侧添加一个链接,使其看起来像这样:

checkbox label [] thelink

我尝试了以下方法,但不是将描述与复选框水平对齐,而是将其置于其下方:

$boolean->setDescription('desc');
        $boolean->setDecorators(array(
            'ViewHelper',
            'Description',
            'Errors',
            array('HtmlTag', array('tag' => 'dd')),
            array('Label', array('tag' => 'dt')),
        ));

我是 Zend Forms 的初学者。知道如何实现吗?

谢谢

【问题讨论】:

  • 我认为您可能需要decorator。看看this SO question 接受的答案,我认为它可能会为您指明正确的方向。
  • 尝试更改 dd 标签的样式(宽度、浮动等)。 $element->getDecorator('HtmlTag')->setOption('style', 'width:20px;');

标签: php zend-framework zend-form


【解决方案1】:

知道了!

我是这样做的:

  $boolean->setDescription('description');
        $boolean->setDecorators(array(
            'ViewHelper',
            'Description',
            'Errors',
            array('HtmlTag', array('tag' => 'dd')),
            array('Label', array('tag' => 'dt')),
            array('Description', array('escape' => false, 'tag' => '', 'placement' => 'append')),
        ));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-29
    • 1970-01-01
    • 2013-02-15
    • 2010-10-28
    相关资源
    最近更新 更多