Disable default decorator(s) for Zend_Form_Element

Zend Framework

In this article i will describe some methods to remove/disable default decorators from Zend_Form_Element. Basicly are two method, one by calling some method if we had an instance of object Zend_Form_Element, and other if we extend or we build a custom Zend_Form_Element is from init method.


So maybe sometimes we don't want that every html input to be encapsulated in dl/dt/dd structure. To achive this we can use:


    $element = new Zend_Form_Element_Text('name', array('disableLoadDefaultDecorators' = true)); 

or from inside of class wich inherits Zend_Form_Element class:

class Form_Element_Custom extends Zend_Form_Element 
    public function init()

After disabling all default decorators is posible that our Zend_Form_Element to not be rendered at all in html form. In this case we add back a simple decorator that will render html input without d;/dt/dd structure, like this:


Add comment


Warning: Unknown: write failed: Disk quota exceeded (122) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0