HTML::...Element(3pm)
π HTML::...Element β Element Base Class π
okay bestie, welcome to the manual page for HTML::...Element (the 3pm one, you know the vibe) β this is the whole Element Base Class situation, and honestly? it's the blueprint for everything. let's go β¨
πΈ VERSION πΈ
version 2.07 β that's the one, no cap.
β¨ SYNOPSIS β¨
okay so here's the whole thing in action, look at it:
---
elements:
- type: Text
name: username
constraints:
- type: Required
- type: Password
name: password
constraints:
- type: Required
- type: Equal
others: repeat-password
- type: Password
name: repeat-password
- type: Submit
iconic. obsessed. moving on π«Ά
π DESCRIPTION π
Elements are, like, the basic building block of all forms. periodt. an Element can be a logical form-field, or a block like divs and fieldsets, or a non-block like hrs, or other special elements like tables. it's giving very versatile π
for simple, automatic handling of fieldsets, go look at the auto_fieldset setting in HTML::FormFu.
for all the tea on Deflators, check deflators in HTML::FormFu.
for Filters, Constraints, Inflators, Validators and Transformers β the whole validation cinematic universe β see FORM LOGIC AND VALIDATION in HTML::FormFu.
π οΈ METHODS π οΈ
name
for a field element, this value gets used as the name attribute that the field's value is associated with.
for all elements, the name value is also useful for identifying and retrieving specific elements. lowkey a great way to keep track of your faves.
is_field
Return Value: boolean
returns true or false depending on whether the element is a logical form-field. vibe check for "are you actually a field or not" π
this is used by get_fields in HTML::FormFu.
π§± BUILDING AN ELEMENT π§±
load_config_file
Arguments: $filename
Arguments: \@filenames
populates an element using a config file, like so:
---
elements:
- type: Block
load_config_file: 'elements.yml'
see load_config_file in HTML::FormFu for further details.
load_config_filestem
Arguments: $filestem
Arguments: \@filestems
like load_config_file, but bestie β you should not include the file extension in the passed string. the whole point is that you can change your config-file type without having to change the code that loads the files. so convenient π
config_file_path
Arguments: $directory_name
config_file_path defines where configuration files will be searched for, if an absolute path isn't given to load_config_file.
Default Value: not defined
this method is a special 'inherited accessor', which means it can be set on the form, a block element, or a single element. when the value is read, if no value is defined it automatically traverses the element's hierarchy of parents β through any block elements and all the way up to the form β searching for a defined value. it's giving main character energy, climbing the whole family tree π³
config_callback
see config_callback in HTML::FormFu for details.
populate
see populate in HTML::FormFu for details.
stash
see stash in HTML::FormFu for details.
type
returns the type argument that was originally used to create the element. the origin story, fr fr.
π¦ CHANGING DEFAULT BEHAVIOUR π¦
render_processed_value
see render_processed_value in HTML::FormFu for details.
force_errors
see force_errors in HTML::FormFu for details.
π ELEMENT ATTRIBUTES π
see specific element types for which tag attributes are added to.
attributes / attrs
Arguments: [%attributes]
Arguments: [\%attributes]
Return Value: $form
see attributes in HTML::FormFu for details.
attrs is an alias for attributes. same girl, different name π
attributes_xml / attrs_xml
see attributes_xml in HTML::FormFu for details.
attrs_xml is an alias for attributes_xml.
add_attributes / add_attrs
Arguments: [%attributes]
Arguments: [\%attributes]
Return Value: $form
see add_attributes in HTML::FormFu for details.
add_attrs is an alias for add_attributes.
add_attributes_xml / add_attrs_xml
see add_attributes_xml in HTML::FormFu for details.
add_attrs_xml is an alias for add_attributes_xml.
del_attributes / del_attrs
Arguments: [%attributes]
Arguments: [\%attributes]
Return Value: $form
see del_attributes in HTML::FormFu for details.
del_attrs is an alias for del_attributes.
del_attributes_xml / del_attrs_xml
see del_attributes_xml in HTML::FormFu for details.
del_attrs_xml is an alias for del_attributes_xml.
the following methods are shortcuts for accessing attributes keys. cute little express lane π
id
Arguments: [$id]
Return Value: $id
get or set the element's DOM id.
Default Value: none
ποΈ MODEL / DATABASE INTERACTION ποΈ
see HTML::FormFu::Model for further details and available models.
model_config
Arguments: \%config
π¨ RENDERING π¨
filename
this value identifies which template file should be used by render to render the element.
prepare_id
Arguments: $render
see prepare_id in HTML::FormFu::Role::Element::Field for details.
prepare_attrs
Arguments: $render
see prepare_attrs in HTML::FormFu::Role::Element::Field for details.
render
Return Value: $string
π INTROSPECTION π
parent
returns the block element or form object that this element is attached to. your element's parental figure, basically π
get_parent
Arguments: \%options
my $repeatable = $field->get_parent({ type => 'Repeatable' });
traverses the parent hierarchy, returning the first parent that matches the supplied options. it goes looking for its people π§
form
returns the HTML::FormFu object that the constraint's field is attached to.
clone
see clone in HTML::FormFu for details.
π₯ ADVANCED CUSTOMISATION π₯
tt_args
see tt_args in HTML::FormFu for details.
render_method
see render_method in HTML::FormFu for details.
π CORE FORM FIELDS π
the whole squad, alphabetically slaying:
HTML::FormFu::Element::ButtonHTML::FormFu::Element::CheckboxHTML::FormFu::Element::CheckboxgroupHTML::FormFu::Element::ComboBoxHTML::FormFu::Element::ContentButtonHTML::FormFu::Element::DateHTML::FormFu::Element::EmailHTML::FormFu::Element::FileHTML::FormFu::Element::HiddenHTML::FormFu::Element::ImageHTML::FormFu::Element::NumberHTML::FormFu::Element::PasswordHTML::FormFu::Element::RadioHTML::FormFu::Element::RadiogroupHTML::FormFu::Element::ResetHTML::FormFu::Element::SelectHTML::FormFu::Element::SubmitHTML::FormFu::Element::TextareaHTML::FormFu::Element::TextHTML::FormFu::Element::URL
π OTHER CORE ELEMENTS π
the rest of the cast, also iconic:
HTML::FormFu::Element::BlankHTML::FormFu::Element::BlockHTML::FormFu::Element::FieldsetHTML::FormFu::Element::HrHTML::FormFu::Element::LabelHTML::FormFu::Element::MultiHTML::FormFu::Element::RepeatableHTML::FormFu::Element::SimpleTableHTML::FormFu::Element::Src
𧬠ELEMENT BASE CLASSES π§¬
these following ones are base classes for other elements, and generally needn't be used directly. they're the backstage crew, the supporting characters β absolutely essential, absolutely not the ones you call up first:
HTML::FormFu::Role::Element::FieldHTML::FormFu::Role::Element::GroupHTML::FormFu::Role::Element::InputHTML::FormFu::Element::_MultiElementHTML::FormFu::Element::_MultiSelectHTML::FormFu::Element::_MultiTextHTML::FormFu::Role::Element::NonBlock
π REMOVED METHODS π
db
has been removed; use default_args instead.
bestie. it's gone. it's not coming back. use default_args, fr fr π
π«Ά 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 so that's the whole page β and the tiny print at the bottom said perl v5.28.1, dated 2019-01-12. that's a wrap, bestie, you ate this π
β¨π
π¦ 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