php - Zend Decorators - Remove Id Field for DT Wrapper -


I get two and they called because they share some ID two input fields 'Title'.

Zend generates a good output like this:

  & lt; Dl class = "zend-form" & gt; & Lt; Dt id = "title-label" & gt; & Lt; Label = "form1-title" class = "required" & gt; Details & lt; / Label & gt; & Lt; / Dt & gt; & Lt; Dd id = "title-element" & gt; & Lt; Input name = "form 1 [title]" id = "form1-title" value = "..." type = "text" & gt; & Lt; / Dd> & Lt; / DL & gt;  

The problem now is that DT and DD elements have been misnamed (should be form-1-title because it is a sub form).

I also tried to change element decorators:

  $ this-> Adelements (...); $ This- & gt; SetElementDecorators (array ( 'ViewHelper', 'Errors', array (array ( 'data' = & gt; 'HtmlTag'), array ( 'tags' = & gt; 'dd', 'class' = & gt; array ( 'data' = & gt; 'label'), array ( 'tags' = & gt; 'DT' class = & gt; 'Labels')))););)  
< P> Although the result was not as expected.

A label was added to my submit button and the ID of the DT Elements was still present.

How can you remove ID attributes?


Edit - Element Declaration:

  $ titel = new Zend_Form_Element_Text ( 'title'); $ Titel- & gt; Set label ("title") - & gt; AddValidator ('NotEmpty' is true) - & gt; AddValidator ('stringLength', true, array (0, 255)) - & gt; Setigised (true) - & gt; AddFilter ("Alnum", Array (true)) - & gt; Adfilter ('string trim'); $ This- & gt; AddElement ($ titel);  

It seems more that the problem is not in your subfomes. If you resolve this, you will not need to remove the ID.

However, if you want to delete the ID from an element using the DTDDRAPP decorator, then you can do something like this.

  class expands Form_Foo Zend_Form_SubForm {public function init () ($ title = new Zend_Form_Element_Text ( 'foo_title'); $ TITLE- & gt; setLabel ( 'title'); $ TITLE- & gt; removeDecorator ( 'DtDdWrapper'); $ title & gt; Ed Dikkoretr (new Dekoretr_fu ()); $ this- & gt; addElement ($ title);}} class Dekoretr_fu render Zend_Form_Decorator_DtDdWrapper {public function ($ content ) {Returns & lt; dt & gt; & amp; nbsp; & lt; / dt & gt; '.' & Lt; dd & gt; '$ Content' & lt; / dd & gt; ';} }  

This should give you an element without an ID tag.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -