To add a div around it you can by just adding another decorator after the
label decorator...

->addDecorator(array('last'=>'HtmlTag', array('tag'=>'div', 'class' =>
'pippo'))

To remove the <dt></dt>, I think you need to set a custom decorator on the
form itself.


Michel Morelli wrote:
> 
> Hi all.
> I have my form (Zend Form) with this element:
> 
> $this->addElement('select','category',array('label' => 'Sotto 
> categoria', 'class' => 'field_category', 'id' => 'field_category'));
>         $this->getElement('category')
>             ->addDecorator('HtmlTag',array('tag' => 'div', 'class' => 
> 'dec_category', 'style' => 'display:none'))
>             ->addDecorator('Label',array('tag' => 'span', 'class' => 
> 'label label_category', 'style' => 'display:none'))
>             ;
> 
> The resultant HTML is:
> 
> 
> <label class="label label_category optional" style="display: 
> none;" for="field_category">Sotto categoria</label>
> 
> <div class="dec_category" style="display: none;">
> <select id="field_category" class="field_category" name="category"> 
> </select>
> </div>
> <dt> </dt>
> 
> I think that the last <dt> </dt> is for the "description" field. How can 
> I remove it ?
> 
> And: I need to enclose all "select" element (select + label) in a <div> 
> with a class/ name like "pippo". Ok, I need this:
> 
> <div class="pippo" id="pippo">
>     
>     <label class="label label_category optional" style="display: 
> none;" for="field_category">Sotto categoria</label>
>     
>     <div class="dec_category" style="display: none;">
>     <select id="field_category" class="field_category" name="category"> 
> </select>
>     </div>
>     <dt> </dt>
> </div>
> 
> How can I do this ?
> 
> Pls help me.
> 
> Tnx.
> 
> -- 
> Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
> Consulenza sistemistica in ambito OpenSource.
> Sviluppo applicazioni web dinamiche (LAMP+Ajax)
> Telefono: 0200619074
> Telefono Cell: +39-3939890025 --  Fax: +39-0291390660
> 
> http://www.ziobudda.net                         ICQ: 58351764  
> http://www.ziobuddalabs.it                      Skype: zio_budda
> http://www.ajaxblog.it                                MSN: 
> mic...@ziobuddalabs.it                   
>                                               JABBER: mic...@gmail.com
> 
> 
> 


-----
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/How-to-create-a-Div-for-an-Zend-Form-Element-with-Label-tp21435453p21437048.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to