I want to include some HTML in the labels of the radio buttons so that the user can click a link within that label. For example
<label for="value-12">
<input name="value" id="value-12" value="12" checked="checked" type="radio">
Doo Bee Dooo Bee Doooo
<a href="somelink">preview this song</a>
</label>
The html keeps getting escaped. I want to stop that. I read about:
array('escape' => false)
Somewhere, but I don't know how to use that with
$value->setMultiOptions($songs);
or
$value->addMultiOptions($songs)
Any ideas? Thanks all!
EDIT
While setting escape to false for the "Label" decorator may work, this is not exactly what I want to do. I want to set escape to false for the labels of the multioptions. The following is not what I want to do. See the HTML I added in the开发者_JS百科 setMultiOptions? That's what I want to escape:
$value = new Zend_Form_Element_Radio('value');
$value->setMultiOptions(array('NULL'=>'None <a href="#">A Link</a>'));
$value->addMultiOptions($this->objlist);
$value->setLabel($this->title);
$value->getDecorator('Label')->setOption('escape', false);
And the answer is:
$value = new Zend_Form_Element_Radio('value', array('escape'=>false));
Thanks to alokin at:
http://forums.zend.com/viewtopic.php?f=69&t=5938&start=0&sid=987612aa8ff8193a04bf73a52196358b
Put it into decorators ;) you need to set that to the Label decorator ;)
$el->getDecorator('Label')->setOption('escape', false);
(not sure about concrete method names, but you get the point)
精彩评论