Issues

ZF-2937: Zend_Element_Radio have no id for javascript access

Description

Zend_Element_Radio elements lack ids for javascript access

I tested this on today's trunk and 1.5 release

Create a subform:

[subfrm]
elements.subfrm.name = "0";
elements.subfrm.type = "radio";
elements.subfrm.options.belongsTo = "subfrm";
elements.subfrm.options.disableLoadDefaultDecorators = "true";
elements.subfrm.options.decorators.ViewHelper.decorator = "ViewHelper";
elements.subfrm.options.value = "true";
elements.subfrm.options.multiOptions.true = "";
elements.subfrm.options.multiOptions.false = "";

After assigning it in the view, print it in the view


<?=$this->form->subfrm?>

The result it:





Expected result





A quick and dirty fix would be: Editing a part of Zend_View_Helper_FormRadio to:


// Wrap the radios in labels
            $radio = '_htmlAttribs($label_attribs) . '>'
                    . (('prepend' == $labelPlacement) ? $opt_label : '')
                    . '_htmlAttribs($attribs) 
                    . $endTag
                    . (('append' == $labelPlacement) ? $opt_label : '')
                    . '';

I don't think its intended to be fixed there however. I haven't digged into the id attaching for textfields etc enough to provide a better fix, maybe i'll do that later.

Comments

Please categorize/fix as needed.

I did more search an learn work on the Zend Framework and actually it is an inconsistency in the Zend_View_Helpers. So i'll recreate the issue there, with a more to-the-point use case.

Reporter indicates the issue is with another component; closing.

Re-opening. This becomes an issue with Dojo's RadioButton dijit when using dojo programmatically; without an ID, we cannot identify the element to decorate it as a dijit.

Resolved in trunk as of r10025.