Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Accessing fieldset and legend for radio buttons #129

Open
automatix opened this issue Nov 1, 2016 · 2 comments
Open

Accessing fieldset and legend for radio buttons #129

automatix opened this issue Nov 1, 2016 · 2 comments

Comments

@automatix
Copy link

An element's label can get attributes, e.g. class. Theoretically this behavior is also possible for radio buttons. But the setLabelAttributes(['class' => 'my_class']) called on a Zend\Form\Element\Radio object sets the attribute(-s) for the input elements and not for the container-element.

And it's not possible to access the fieldset or the legend element, that are "hard-coded" in the Zend\Form\View\Helper\FormRow. (Also the maintaining of a custom view helper for the 135 rows long FormRow#render(...) is not easy.)

It would be nice to be able to set the fieldset's and legend'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. For radio's an access to the fieldset and/or at least to the legend is needed.

@dennis-fedco
Copy link

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.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at laminas/laminas-form#20.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants