Zend Framework: Add HTML to form element label

This post is more than 18 months old. Since technology changes to rapidly, this content may be out of date (but that's not always the case). Please remember to verify any technical or programming information with the current release.

By default, the labels of form elements in Zend Form are escaped. Sometimes, like in check mark boxes for Terms of Use, it makes sense to add some HTML to this. You can turn off escaping - but just be careful!


$this->getElement('agreetos)->getDecorator('Label')->setOption('escape', false);

So, there you go - you can now add a link to that label.

Return to All Posts

or use RSS