2008年11月19日星期三

[fw-mvc] Zend_Form : How to set a class for the label wrapper?

Hi list,


I'd like to set a class attribute for the label wrapper element and I'm not being able to do this.

My code:

$form =
new Zend_Form();

$fieldEmail = $form->createElement(
    'text',
    'email',
    array('label' => 'Email:')
)->setRequired(true);

$fieldEmail->getDecorator('Label')->setOption('class', 'clear');


What I'm getting is:

<dt>
    <label for="email" class="required clear">Email:</label>
</dt>

<dd>
    <input type="text" value="" id="email" name="email"/>
</dd>


And what I'd like to have is:

<dt class="clear">
    <label for="email" class="required">Email:</label>
</dt>

<dd>
    <input type="text" value="" id="email" name="email" />
</dd>


Any help? Ideas?


Best regards,

--
Ramses Paiva
Software Architect
Sourcebits Technologies
www.sourcebits.com

没有评论: