The default decorators on an element are:
• ViewHelper
• Errors
• Description (only renders if a description is set)
• HtmlTag
• Label
Heres one of my hidden elements:
$this->addElement('hidden', 'userId', array(
'filters' => array('StringTrim'),
'required' => true,
'decorators' => array('viewHelper',array('HtmlTag',
array('tag' => 'dd', 'class' => 'noDisplay')))
));
So the decorators are:
'decorators' => array(
'viewHelper',
array('HtmlTag', array('tag' => 'dd', 'class' => 'noDisplay'))
)
I use a css class to hide the dd tag so that there is no gaps in the
form visually, you could also do this for the dt as well.
Hope this helps
2009/3/26 Ed Lazor <edlazor@internetarchitects.biz>:
> Hi :)
>
> How do I remove the dt/dd wrapper from a hidden form element?
>
> -Ed
>
>
> My form has:
>
> $ID = new Zend_Form_Element_Hidden("ID");
> $ID->removeDecorator('DtDdWrapper');
> $this->addElement($ID);
>
> But the resulting output is still:
>
> <dt> </dt>
> <dd>
> <input type="hidden" name="ID" value="7" id="ID"></dd>
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------
没有评论:
发表评论