Hit send too soon. Here is the context behind the question.
Anyway, I want to set the name field not the id because it has impacts to how you write Javascript interacting with the form. For example, if I want to do something like an onChange sumbit behavior for a specific form element, this is easily done with the one-liner:
document.myForm.submit();
But with the "name" attribute not set, the above generates an error. Instead you have to do something like this with Javascript:
myForm = document.getElementById('myForm');
myForm.submit();
It's not the worst thing in the world, but still I'd just like to be able to assign the "name" attribute of the form
--Seth
From: Atkins, Seth (RICH1:5278)
Sent: Sunday, July 19, 2009 1:52 PM
To: fw-mvc@lists.zend.com
Subject: cannot set the "name" field on a form
There appears to be a limitation in Zend_Form where you can set the "id" attribute but not the "name" attribute on the field itself. Elements you can set the name, but not the form.
I've tried several things to do this and they all result in just the "id" attribute getting set:
$this->setName('myForm');
this results in HTML that looks like this
<form id="myForm" enctype="application/x-www-form-urlencoded" action="" method="post"><table>
Other attempts yielded the exact same result. Such as:
$this->setAttrib('name', 'myForm'); <---- sets the "id", not the "name".
$this->setAttribs(array('id' => 'myForm', 'name' => 'myForm' )); <---- sets the "id", not the "name".
Seth Atkins
没有评论:
发表评论