Se4t Escaping for Zend_Form element description to false
I'm having some trouble dealing with this. This is inside my Zend_Form:
$about = $this->addElement('textarea', 'about', array(
'label' => 'About:',
'description' => 'some <strong>description</strong>',开发者_如何学JAVA
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(
array('validator' => 'StringLength', 'options' => array(0, 1024)),
)
));
So for this about element I should have a description 'some description'.
The problem is the description is being escaped so what I get is 'some description...
Now If I try to use $about->setDescription("some-text");
instead of setting the description key my description doesn't show. If I try to do anything that is described here ( http://devzone.zend.com/article/3450#comments-3486 ) either my form disappears or if I try to get the decorator I get null, so I get an error if I try to call the $decorator->setOption()
method.
Any ideas?
Okay, I don't know why this happens, maybe it is even intended to (maybe I failed reading all the documentation of Zend_Form).
Anyway, in the view script where I retrieve the form I can make it work...
How?
<?php $this->form->getElement("about")->getDecorator("description")->setEscape(false); ?>
精彩评论