I have the following element in Zend form:
$this->addElement('Select', 'my_element', array(
'label' => 'My Element',
'description' => 'My link <a href="https://www.google.com/">here</a>',
'multiOptions' => array(
'opt_one' => 'Option One',
'opt_two' => 'Option Two',
),
));
I have also tried to add 'escape' => true,
after 'multiOptions', but it does not take effect. Any idea how I could make the HTML work in 'label' and 'description'.
Try to do like this:
$select = new Zend_Form_Element_Select('my_element', array(
'label' => 'My Element',
'description' => 'My link <a href="https://www.google.com/">here</a>',
'multiOptions' => array(
'opt_one' => 'Option One',
'opt_two' => 'Option Two'
)));
$select->getDecorator('Description')->setOption('escape', false);
$form->addElement($select);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.