Friday 15 March 2013

php - Wrap tags inside zend form -


How do I wrap the DT DD tag in the zd file. The last look of my HTML code that is generated is:

  & lt; Dt id = "email-label" & gt; & Lt; Label = "email" class = "optional" & gt; For username (email): & lt; / Label & gt; & Lt; / Dt & gt; & Lt; Dd id = "email-element" & gt; & Lt; Input type = "text" name = "email" id = "email" value = "" & gt; & Lt; / Dd>   

The code for this is:

  $ form-> Adelament ('text', 'email'); $ UsernameElement = $ form-> GetElement ('email'); $ UsernameElement-> SetLabel ('Username (email):');   

I want these two tags to be wrapped inside an original tag such as:

   & Lt; / Div & gt;   

So how could I do this in the Zend framework?

Try it out,

  $ usernameElement-> SetDecorators (Array ('ViewHelper', 'Label', New Zend_Form_Decorator_HtmlTag (array ('Tag' => gt; 'div', 'id' = & gt; 'form_wrapper'))));    

No comments:

Post a Comment