HTML::...:Group(3pm)
π HTML::FormFu::Role::Element::Group π
okay bestie, welcome to the HTML::...:Group(3pm) page from the User Contributed Perl Documentation β¨ this is the whole thing, no skips, and it's lowkey giving "quietly holds the entire group of form fields together" energy. sit down, grab a strawberry π, let's go.
πΈ NAME πΈ
HTML::FormFu::Role::Element::Group β the Role for grouped form fields. it's a role, not a class, she's vibes only π
β VERSION β
version 2.07
π¦ DESCRIPTION π¦
okay so this is the base class for HTML::FormFu::Element::Checkboxgroup, HTML::FormFu::Element::Radiogroup, and HTML::FormFu::Element::Select fields. the three of them are literally sharing a brain and that brain is this role. main character energy, fr fr π
π METHODS π
β¨ options β¨
Arguments: none
Arguments: \@options
---
elements:
- type: Select
name: foo
options:
- [ 01, January ]
- [ 02, February ]
- value: 03
label: March
attributes:
style: highlighted
- [ 04, April ]
so! if you pass it no arguments, it hands you back an arrayref of the options that are currently set. no notes, just receipts π§Ύ
use it to set the list of items in the select menu / radiogroup.
its arguments must be an array-ref of items. each item can be either:
- an array ref shaped like
[ $value, $label ], or - a hash-ref shaped like
{ value => $value, label => $label }
and each hash-ref may also carry an attributes key. obsessed.
if you pass an item that contains a group key, then:
- for Select fields, it creates an optgroup π
- for Radiogroup fields or Checkboxgroup fields, it creates a sub-group of radiobuttons or checkboxes with a new
spanblock, with the classnamesubgroup
an example of Select optgroups, pls enjoy:
---
elements:
- type: Select
name: foo
options:
- label: "group 1"
group:
- [1a, 'item 1a']
- [1b, 'item 1b']
- label: "group 2"
group:
- [2a, 'item 2a']
- [2b, 'item 2b']
when you're using the hash-ref construct, the label_xml and label_loc variants of label are supported π«Ά as are the value_xml and value_loc variants of value, the attributes_xml variant of attributes and the label_attributes_xml variant of label_attributes. so many little variants, she contains multitudes.
container_attributes or container_attributes_xml is used by HTML::FormFu::Element::Checkboxgroup and HTML::FormFu::Element::Radiogroup for the c<span> surrounding each item's input and label. it is ignored by HTML::FormFu::Element::Select elements. (Select said "not my problem" π)
label_attributes / label_attributes_xml is used by HTML::FormFu::Element::Checkboxgroup and HTML::FormFu::Element::Radiogroup for the c<label> tag of each item. it is also ignored by HTML::FormFu::Element::Select elements. same vibe, same shrug π
π values π
Arguments: \@values
---
elements:
- type: Radiogroup
name: foo
values:
- jan
- feb
- mar
- apr
a more concise alternative to options. use it to set the list of values in the select menu / radiogroup. it's the "I don't have time for the whole thing" version and honestly? slay.
its arguments must be an array-ref of values. the labels used are the result of ucfirst($value). that's it, that's the whole trick β¨
π§ value_range π§
Arguments: \@values
---
elements:
- type: Select
name: foo
value_range:
- ""
- 1
- 12
similar to values, but the last 2 values get expanded to a range π₯ any preceding values are used literally, which lets you do the super common empty first item in select menus. iconic behaviour tbh.
π empty_first π
if true, then a blank option will be inserted at the start of the option list β and yes, regardless of whether options, values or value_range was used to populate the options. see also empty_first_label.
π empty_first_label π
π empty_first_label_xml π
π empty_first_label_loc π
if empty_first is true, and empty_first_label is set, this value will be used as the label for the first option β so only the first option's value will be empty. sneaky, clever, we love her π
π SEE ALSO π
is a sub-class of, and inherits methods from HTML::FormFu::Role::Element::Field, HTML::FormFu::Element
HTML::FormFu
π AUTHOR π
Carl Franks, cfranks@cpan.org
β LICENSE β
this library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
π¦ AUTHOR π¦
Carl Franks <cpan@fireartist.com>
πΈ COPYRIGHT AND LICENSE πΈ
this software is copyright (c) 2018 by Carl Franks.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page bestie, no cap, every last detail preserved π«Ά and for the cute sign-off: this one's running on perl v5.28.1 and the page is dated 2019-01-12 β she's a little vintage, she's still that girl, periodt π
β¨π
π¦ where this page comes from
- debian bookworm: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms