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

Issue Type: Bug Created: 2008-07-14T07:40:33.000+0000 Last Updated: 2008-07-24T09:27:35.000+0000 Status: Resolved Fix version(s): - 1.5.3 (28/Jul/08)

Reporter: Karol Grecki (antych) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: Attachments:


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.


Posted by Slavius (slavius) on 2008-07-17T13:24:07.000+0000

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="">

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-17T13:29:19.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-17T14:20:00.000+0000

Changing component to Zend_View

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-18T15:02:24.000+0000

Fixed in trunk as of r10196

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-22T08:38:17.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-22T08:40:27.000+0000

scheduling for 1.5.3.

Posted by Matthew Weier O'Phinney (matthew) on 2008-07-24T09:27:35.000+0000

Fixed in trunk and 1.5 and 1.6 release branches.

Have you found an issue?

See the Overview section for more details.


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

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