Subscript or superscript text in a Zend form label

I would like to include the substring text in the Zend_Form_Element shortcut and it doesn't seem to work:

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

Is there anything I can do to display it correctly without having to manually write the form on the watch page? Thanks for the help,

Dave

+4
source share
5 answers

Here is the correct way:

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

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

+3
source

I would say that the best way is to get the actual decorator from the element and then set the escape option rather than adding a new decorator:

 $zend_form_element->getDecorator('Label')->setOption('escape',false); 
+6
source

Try:

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

Or the only thing:

 $zend_form_element->setAttrib( 'escape', false ) ->setLabel( 'Label <sub>x</sub>' ); 
+1
source

You can also do this as follows:

 $radioElement = new Zend_Form_Element_Checkbox('formelement_0'); $radioElement->setLabel('Do you accept the <a href="#">Terms &amp; Conditions</a>?'); $radioElement->getDecorator('Label')->setOption('escape', false); 
+1
source

From @fireeyedboy's answer, you can also do the following directly in your Zend_Form:

 $this->addElement( 'radio', 'name', array( /* more settings */ 'attribs' => array( 'escape' => FALSE ) )); 
0
source

Source: https://habr.com/ru/post/1304514/


All Articles