Search code examples
htmlescapinglegendzend-form-sub-form

In Zend SubForm, how do I set Legend escape to false?


I've got a subform, where I set a legend.

$dob = new Zend_Form_SubForm();
$dob->addElement($birthdayMonth)
->addElement($birthdayDay)
->setLegend('when is your birthday?');

How do I set the Legend so it won't escape the text?

Usually I'd get the decorator, but this doesn't work:

$decorator = $dob->getDecorator('Legend');
$decorator->setOption('escape', false); 

Solution

  • You can set the Fieldset decorator, it passes it to the Legend field.

    $dob->getDecorator('Fieldset')
        ->setOption('escape', false);