views:

16

answers:

1

how can i go abt setting up default decorators for all my forms & form elements? currently in individual forms i do something like

// in init()
...
$this->setElementDecorators(array(
    'ViewHelper',
    'Errors',
    array('Description', array('tag' => 'p')),
    'Label',
    array('HtmlTag', array('tag' => 'p'))
));
$this->getElement('btnLogin')->removeDecorator('Label');
$this->setDecorators(array(
    'FormElements',
    array('Errors', array('placement' => 'PREPEND')),
    'Form'
));

one part i see maybe harder is i want my submit buttons not to have a label.

A: 

For forms you can override Zend_Form class with your own and redefine loadDefaultDecorators method there. Then just inherit your forms from your form class. Zend_Form_Element also has loadDefaultDecorators method.

Ololo
i can override the `Zend_Form.loadDefaultDecorators()` but can i override **all** child elements under **my** `Zend_Form`s? if i do override `loadDefaultDecorators()` in `Zend_Form_Element`, i need to create many (those i want to use) concrete `Zend_Form_Element` classes?
jiewmeng
what i did to set the element decorators was a custom class [On Snipplr](http://snipplr.com/view/37906/custom-zendform-changed-decorators--added-methods/)
jiewmeng