Search code examples
zend-frameworkzend-formzend-decorators

Zend_Form::setElementDecorators $elements param doesn't make a difference


From the docs ...

Zend_Form setElementDecorators ( $decorators, [ $elements = null], [bool $include = true])

array $decorators
array|null $elements: Specific elements to decorate or exclude from decoration
bool $include: Whether $elements is an inclusion or exclusion list

I wanted to re-use the same decorators for most of my elements ... but not the submit buttons ... I tried

...

$this->addElement('submit', 'btnSubmitProject', array(
  'label' => 'Add Project',
  'ignore' => true
));

$this->setElementDecorators(
  array(
    'ViewHelper',
    'Errors',
    'Label'
  ),
  array(
    'btnSubmitProject', 'submit' // I think I should be using the 1st (btnSubmitProject) but I have 'submit' just to be sure
  ),
  true // and false
);

I tried true & false for the $include flag. Both does not seem to make a difference. All elements are styled the same, with label


Solution

  • $sumbit ->removeDecorator('label');