ZF-3643: $form->setAttrib('id', 'foo'); has no effect


I assume that according to the manual $form->setAttrib('id', 'foo') should work and set the id="foo"; but it does't work, the result is always id="" (empty) $form->setName('foo') on the other hand seems to set the id instead of a name.


Same here:

$logoutform = new Zend_Form();
    ->setAttrib('id', 'formlogout');



form id="logoutform" enctype="application/x-www-form-urlencoded" method="post" action="">

instead of:


form name="logoutform" id="formlogout" enctype="application/x-www-form-urlencoded" method="post" action="">

This is an incorrect diagnosis. If you echo getAttrib('id'), it will give the correct value. The issue is that the Form view helper is not using the ID attribute when generating the form tag, and instead always using the passed name.

Changing component to Zend_View

Fixed in trunk as of r10196

Re-opened due ot report on, and verified not working with current trunk (id is reported as empty string)

scheduling for 1.5.3.

Fixed in trunk and 1.5 and 1.6 release branches.