ZF-6174: Zend_Form elements: must be able to allow disabling id attribute
Zend_Form elements should be able to allowed to disable the rendering of the id attribute. It seems that, when id is explicitly set to null, the id attribute is automatically assigned the name of the element. Right now I'm working on a CMS that has multiple identical forms which should allow the same (hidden) form elements. Consider the following example:
Now, if the hidden elements (or the submit elements for that matter) are automatically assigned an id attribute value (left out in this example) equivalent to the name attribute value, this results in non valid W3C (x)html code, because of repetitive equivalent id's.
I strongly believe developers should be able to decide for themselfs whether they want the id attribute automatically rendered if no value is given (or rendered at all for that matter). Perhaps with some method like
Zend_Form [ _Element ]::autoAssignIdAttrib( /* true | false */ ); // be it a static global method or an instance method
I think you should not let developers resort to creating unique id's with a mandatory routine. Especially if the developer feels assigning id's to the elements is unnessecary anyway, when s/he has no use for it, because they are not gonna manipulate the elements with some type of clientside scripting.