Issues

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

Issue Type: Sub-task Created: 2010-01-25T11:04:21.000+0000 Last Updated: 2010-04-21T16:38:52.000+0000 Status: Resolved Fix version(s): Reporter: Stephan "Bladed" de Souza (bladed) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: - ZF-9409

Attachments:

Description

Hello,

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.

<pre class="highlight">
$form = new Zend_Form();
$step1 = new Zend_Form_SubForm();
$form->addSubForm($step1,'step1');
...

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

That generate the following HTML Tree: http://img.ragnabr-files.net/storage/box32/…! 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.

Comments

Posted by Anselm Föhr (anselm) on 2010-03-24T07:07:16.000+0000

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();

Posted by Christian Albrecht (alab) on 2010-04-21T16:38:52.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts