ZF-706: Cannot specify id attribute for hidden fields in 0.6.0
Description
Prior to ZF 0.6.0 (eg 0.2.0) I could specify the id of hidden fields like:
$this->formHidden($name, $value, array("id" => "theId"));
When moving to ZF 0.6.0 from 0.2.0, the resulting html no longer has the id attribute, which breaks my javascript code.
I have looked at some ZF code briefly and it seems that the function Zend/View/Helper/FormElement::_getInfo is unsetting the id field when creating the $info array, and the _hidden function does not use the $id after extract()'ing that variable, so the id gets lost.
I have temporarily hacked my copy of ZF 0.6.0 to include the id, it also affects formCheckbox, which is also losing the id. I do not know if there are any other cases.
I have not marked this issue as a bug as I dont know if this is by design, but it's certainly breaking my code (that worked on 0.2.0) and I see no reason why I cannot specify an id for a hidden field.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2007-01-17T09:48:01.000+0000
Resolved in version 2856.
Posted by Drew Bertola (drewb) on 2007-03-06T16:07:32.000+0000
This is still very much broken.
Given my current version of ZF (svn Revision 1546) + the patch here, this code:
results in this output:
You can see that the "id" attribute is picking up the value assigned to "name".
It looks like this may be happening in FormElement::_getInfo() near the top (line 80, or so).
Posted by Drew Bertola (drewb) on 2007-03-06T16:32:57.000+0000
Oops, sorry, looks like a misfire on my part. Someone else made an unannounced change in the config that changed the zf library path. Not nice.