How to Add HTML into Zend_Form_Element label
- zendnwar
- April 30, 2012
- Zend basic
- 246 Comments
This is very simple add a html into Zend_Form_Element label
just follow given code i hope it will be help for u.
$checkbox->setLabel(' <a href="/auth/forgot">
Forgot Password
</a>');
$element->setDecorators(array(array('Label', array('escape' => false))));
This worked for the HTML part as my link now appeared, but I didn’t see my checkbox, just the label. So looking at the method name I assumed it overwrote the default decorators and found out that I was correct. The easy way to get the link in while maintaining the default decorators is to simply add the decorator.
$checkbox->addDecorator('Label', array('escape' => false));