0

私は Zend Framework にかなり慣れていないので、行き詰まっています。

次のコードは、問題が発生しているフォームのデコレータ設定のスニペットです。

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

ビューでエラーがレンダリングされると、次のようになります。

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

label を含むすべての html を削除するにはどうすればよいです<b>First Name: </b>か?

4

2 に答える 2

2

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)));
于 2012-10-22T06:45:59.667 に答える