douji8033 2012-10-22 06:40
浏览 18

如何从Zend FormErrors中删除默认的<b> </ b>标签

I'm fairly new the Zend Framework and I'm stuck.

The following code is a snippet of my form's decorator setting where I'm experiencing a problem:

// prepend errors to top
$this->setDecorators(
    array(
        'FormElements',
        'Form',
        array(
            'FormErrors',
             array(
                'placement' => Zend_Form_Decorator_Abstract::PREPEND
             )
         )
    )
); 

When errors are rendered on the view I get the following:

    <ul class="form-errors">
       <li>
          <b>First Name: </b>
          <ul class="errors">
             <li>You forgot to enter your First Name.</li>
          </ul>
       </li>
    </ul>

How do you remove all of the html including the label <b>First Name: </b>?

  • 写回答

2条回答 默认 最新

  • douza19870617 2012-10-22 06:45
    关注

    Just create custom decorator, try something like this

    protected $_errorDecorator = array(
        'markupElementLabelEnd'   => '',
        'markupElementLabelStart' => '',
        'placement'=>Zend_Form_Decorator_Abstract::PREPEND
    );
    
    $this->setDecorators(array('FormElements','Form',
        array('FormErrors',
        $_errorDecorator)));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测