I've got a few random issues with decorator related stuff with Zend Form.
Firstly,
// THIS WORKS AND REMOVES THE DECORATORS
$hidden = new Zend_Form_Element_Hidden('hiddenfield');
$hidden->setRequired(TRUE)
->removeDecorator('label')
->removeDecorator('HtmlTag')
->addErrorMessage('Please upload something');
// BUT IT DOESNT WORK HERE - THE DECORATORS ARENT REMOVED
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Proceed to Part 2 of 2')
->removeDecorator('label')
->removeDecorator('HtmlTag')
->setAttrib('class', 'button fleft cta');
Secondly, a form element created like this:
$comments = new Zend_Form_Element_Textarea('comments');
$comments->setLabel('Any comments')
->setRequired(FALSE);
and added to a display group like this:
// THIS DOESNT WORK
$this->addDisplayGroup(array('comments'),'comments');
$comms = $this->getDisplayGroup('comments');
$comms->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'dl')),
'Fieldset'
));
isnt added to a Fieldset but a custom form element using the same code is added to its own fieldset:
// THIS WORKS!
$this->addDisplayGroup(array('custom'),'custom',array('legend'=>'Legend Here'));
$swfupload = $this->getDisplayGroup('swfupload');
$swfupload->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'dl')),
'Fieldset'
));