Open automatix opened 8 years ago
There appears to be no way to add attributes, such as an id
to the generated fieldset that gets created for Element\Radio
button, when ['options']['label'] value is used. I can add attributes to the individual <label>
tags, or to the individual <input>
tags, but not to the enveloping <fieldset>
tag.
Currently, I used CSS selectors/pseudo-classes to get around this issue.
This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at https://github.com/laminas/laminas-form/issues/20.
An element's
label
can get attributes, e.g.class
. Theoretically this behavior is also possible for radio buttons. But thesetLabelAttributes(['class' => 'my_class'])
called on aZend\Form\Element\Radio
object sets the attribute(-s) for theinput
elements and not for the container-element.And it's not possible to access the
fieldset
or thelegend
element, that are "hard-coded" in theZend\Form\View\Helper\FormRow
. (Also the maintaining of a custom view helper for the135
rows longFormRow#render(...)
is not easy.)It would be nice to be able to set the
fieldset
's andlegend
's attributes of radio buttons /multi_checkbox
'es (and generally of all elements, affected by this code).An example of a situation, when it's need, is makring elements as required using the
:before
CSS pseudo-class. For text fields it can be managed by setting the class attribute for the label. Forradio
's an access to thefieldset
and/or at least to thelegend
is needed.