Zend Framework Zend_Form Decorators: <span> Inside Button Element?
Posted
by leek
on Stack Overflow
See other posts from Stack Overflow
or by leek
Published on 2009-04-22T19:23:48Z
Indexed on
2010/03/14
19:25 UTC
Read the original article
Hit count: 380
I have a button element that I've created like so:
$submit = new Zend_Form_Element_Button('submit');
$submit->setLabel('My Button');
$submit->setDecorators(array(
'ViewHelper',
array('HtmlTag', array('tag' => 'li'))
));
$submit->setAttrib('type', 'submit');
This generates the following HTML:
<li>
<label for="submit" class="optional">My Button</label>
<button name="submit" id="submit" type="submit">My Button</button>
</li>
I would like to wrap the inside of the button with a <span>, like this:
<button...><span>My Button</span></button>
What is the best way to do this using Zend_Form?
© Stack Overflow or respective owner