views:

196

answers:

3

I would like to include subscript text in a Zend_Form_Element's label, and it doesn't seem to be working:

 $zend_form_element->setLabel('Label <sub>x</sub>');

Is there anything I can do to get it to output properly without having to manually write the form on the view page? Thanks for the help,

Dave

A: 

Try:

$zend_form_element->setAttribs( array( 'escape' => false ) )
                  ->setLabel( 'Label <sub>x</sub>' );

Or the singular:

$zend_form_element->setAttrib( 'escape', false )
                  ->setLabel( 'Label <sub>x</sub>' );
fireeyedboy
That was close, but apparently, you have to put 'escape' => false on the actual decorator for the form element: $zend_form_element->addDecorator('Label', аrray('escape'=>false));
Dave Morris
+1  A: 

Here is the right way to do it:

$zend_form_element->addDecorator('Label', аrray('escape'=>false));

from: http://forums.zend.com/viewtopic.php?f=69&amp;t=5706

Dave Morris
A: 

I would say that best way is to get actual decorator from element and then set escape option, not to add new decorator:

$zend_form_element->getDecorator('Label')->setOption('escape',false);
Matej Bartok