I have a class that extends Zend_Form like this (simplified):
class Core_Form extends Zend_Form
{
protected static $_elementDecorators = array(
'ViewHelper',
'Errors',
array('Label'),
array('HtmlTag', array('tag' => 'li')),
);
public function loadDefaultDecorators()
{
$this->setElementDecorators(self::$_elementDecorators);
}
}
I then use that class to create all of my forms:
class ExampleForm extends Core_Form
{
public function init()
{
// Example Field
$example = new Zend_Form_Element_Hidden('example');
$this->addElement($example);
}
}
In one of my views, I have a need to display only this one field (without anything else generated by Zend_Form). So in my view I have this:
<?php echo $this->exampleForm->example; ?>
This works fine, except for it generates the field like this:
<li><input type="hidden" name="example" value=""></li>
This is obviously because I set the element decorators to include HtmlTag: tag => 'li'.
My question is: How can I disable all decorators for this element. I don't need decorators for hidden input elements.