ZF-8933: DtDdWrapper Decorator not using generated Belong's To Element Name



Following the W3C HTML Standards: ID must be unique!

Using a SubForm in a for loop, it is remarkable that the elements use part of its name the element to which they refer, but DtDdWrapper not follow this pattern using only the element name as a reference.

$form = new Zend_Form();
$step1 = new Zend_Form_SubForm();

$step2 = new Zend_Form_SubForm();
For($i=1;$i<=5;$i++) {
   $atividadesProfissionaisForm = new Zend_Form_SubForm();
   $dataInicioElement = new Zend_Form_Element_Text('data_inicio');
   $step2->addSubForm($subForm, 'atividades_profissionais['.$i.']');

That generate the following HTML Tree: !…! Yellow background: Indicate $step2 (instance of Zend_Form_SubForm) Green background: Indicate $atividadesProfissionaisForm¹ (instance of Zend_Form_SubForm) Blue background: Indicate $atividadesProfissionaisForm² (instance of Zend_Form_SubForm) Red background: Missing the identification as on the element exists ($step2 + $atividadesProfissionaisForm¹) / ($step2 + $atividadesProfissionaisForm²)

Can't see how to explain exactly.


This is a simple example which produces invalid html:

$f = new Zend_Form(); $e = new Zend_Form_Element('foo'); $f->addElement($e);

$s = new Zend_Form_SubForm(); $e = new Zend_Form_Element('foo');

$s->addElement($e); $f->addSubForm($s, 'sub');

echo $f->render();

Fixed in trunk r21961 and r21964, sheduled for next minor release.