Issues

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

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.

This discussion has emerged again in ZF-10791