In Zend_Form is it possible to prepend an element with a pair of html tags containing text using decorators?How?
Ex:
<div>My text inside html tags prepended..</div><input type='text'>
EDITED:
And what if I want to place a form element in a pair of html tags still containing text?
Ex.
<div>
This div is containing both my custom text and my form element:
<input type='text'>
</div>
thanks
Luca
Just use
$element->setDescription("My text");
You can also use a label if you want.
If you need you can use HtmlTag helper to be used by your decorator also, and set the position to be PREPEND.
$elementDecorators = array(
'ViewHelper',
array('Label', array( 'tag' => 'span', 'placement' => 'prepend')),
array('Description', array( 'tag' => 'div', 'placement' => 'append','class'=>'eDesc')),
array('HtmlTag', array( 'tag' => 'div', 'class'=>'userElement'))
);
$element->setDecorators( $elementDecorators);