How to prevent escaping on Zend Form Select : Zend Framework
how to prevent escaping html on zend form elemnt ? My code is not work at all
$this->addElement('Select', 'forum_icon', array(
'label' => 'Forum Icon',
'value' => $this->_forum->FORUM_ICON,
'escape' => false,
'multiOptions' => $icons
));
i try another method but it still not work
$this->forum_icon->开发者_如何学JAVAsetAttrib('escape', false);
thanks in advance,
Brian
You can implement your decorator for Select element that generates HTML for select with unescaped value. For example:
class My_Select_Decorator extends Zend_Form_Decorator_Abstract
{
public function render($content)
{
$element = $this->getElement();
// Generate HTML markup
return $markup;
}
}
Refer to these articles for more information:
http://weierophinney.net/matthew/archives/212-The-simplest-Zend_Form-decorator.html
http://codeutopia.net/blog/2008/08/07/zend_form-decorator-tips/
精彩评论