HTML::Widget::Element::RadioGroup - Radio Element grouping
my $e = $widget->element( 'RadioGroup', 'foo' ); $e->comment('(Required)'); $e->label('Foo'); # label for the whole thing $e->values([qw/foo bar gorch/]); $e->labels([qw/Fu Bur Garch/]); # defaults to ucfirst of values $e->comments([qw/funky/]); # defaults to empty $e->value("foo"); # the currently selected value $e->constrain_values(1);
RadioGroup Element.
As of version 1.09, an In constraint is no longer automatically added to RadioGroup elements. Use constrain_values to provide this functionality.
Add a comment to this Element.
This label will be placed next to your Element.
Because the RadioGroup is placed in a fieldset
tag, you can also set a
</legend> value. Note, however, that if you want the RadioGroup to be styled
the same as other elements, the label setting is recommended.
List of form values for radio checks. Will also be used as labels if not otherwise specified via the labels manpage.
Set which radio element will be pre-set to "checked".
value is provided as an alias for checked.
The labels for corresponding values.
If true, an In constraint will automatically be added to the widget, using the values from values.
If true, overrides the default behaviour, so that after a field is missing from the form submission, the xml output will contain the default value, rather than be empty.
To horizontally align the radio buttons with the label, use the following CSS.
.radiogroup > label { display: inline; }
A RadioGroup is now rendered using a fieldset
tag, instead of a label
tag. This is because the individual radio buttons also use labels, and the
W3C xhtml specification forbids nested label
tags.
To ensure RadioGroup elements are styled similar to other elements, you must
change any CSS label
definitions to also target the RadioGroup's class.
This means changing any label { ... }
definition to
label, .radiogroup_fieldset { ... }
. If you're using the simple.css
example file, testing with firefox shows you'll also need to add
margin: 0em;
to that definition to get the label to line up with other
elements.
If you find the RadioGroup fieldset
picking up styles intended only for
other fieldsets, you can either override those styles with your
label, .radiogroup_fieldset { ... }
definition, or you can change your
fieldset { ... }
definition to .widget_fieldset{ ... }
to specifically
target any Fieldset elements other than the RadioGroup's.
Previously, if there were any errors, the the label manpage tag was given the
classname labels_with_errors
. Now, if there's errors, the RadioGroup
fieldset
tag is wrapped in a span
tag which is given the classname
labels_with_errors
. To ensure that any labels_with_errors
styles are
properly displayed around RadioGroups, you must add display: block;
to
your .labels_with_errros{ ... }
definition.
the HTML::Widget::Element manpage
Jess Robinson
Yuval Kogman
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.