Hey,
I got two forms and they share some ids as two input fields are called 'title'.
Zend generates me a nice output like this:
<dl class="zend-form">
<dt id="title-label">
<label for="form1-title" class="required">Description</label>
</dt>
<dd id="title-element">
<input name="form1[title]" id="form1-title" value="..." type="text">
</dd>
</dl>
Now the problem is that the dt and the dd elements are named wrong (should be form1-title-lable as this is a sub form).
I also tried to change the element decorators:
$this->addElements( ... );
$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'),array( 'tag' => 'dd', 'class' => 'element' )),
array(array('data' => 'Label'),array( 'tag' => 'dt', class=> 'label' ))
));
However the outcome wasn't as expected.
A label was added to my submit button and the ids of the dt elements were still there.
How do you remove the id attributes?
Edit - Element declaration:
$titel = new Zend_Form_Element_Text('title');
$titel->setLabel( "Title" )
->addValidator('NotEmpty', true)
->addValidator('stringLength',true, array(0, 255 ))
->setRequired(true)
->addFilter("Alnum", array(true))
->addFilter('StringTrim');
$this->addElement($titel);