ZF-4342: $form->setName('nameAttr'); has no effect
Description
hello, i'm trying to set up a form with a name attribute, but without success:
$form = new Zend_Form(); $form ->setAttrib ('id', 'idAttr'); $form ->setAttrib ('class', 'classAttr'); $form ->setName('nameAttr'); [...]
I've seen that $name = $form->getName(); is returning the right value ('nameAttr'), but $this->view->form = $form;
produces:
<
form id="idAttr" enctype="application/x-www-form-urlencoded" class="classAttr" action="" method="post">
If I remove or comment: $form ->setAttrib ('id', 'idAttr');
it produces:
<
form id="nameAttr" enctype="application/x-www-form-urlencoded" class="classAttr" action="" method="post"> (see ZF-3643 too)
thanks for your answer. Didier Maurer
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-11-07T14:35:52.000+0000
According to the W3C, "name" is not a valid attribute of
<
form>, while "id" is. If you set an explicit id on the form, it will be used; otherwise, it uses the form name as the id attribute. This is by design.
Posted by Adam Lundrigan (adamlundrigan) on 2010-12-17T08:42:06.000+0000
This discussion has emerged again in ZF-10791