The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::FormFu::Element - Element Base Class

SYNOPSIS

    ---
    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

DESCRIPTION

Elements are the basic building block of all forms. Elements may be logical form-fields, blocks such as divs and fieldsets, non-blocks such as hrs and other special elements such as tables.

For simple, automatic handling of fieldsets see the "auto_fieldset" in HTML::FormFu setting.

See "deflators" in HTML::FormFu for details of Deflators.

See "FORM LOGIC AND VALIDATION" in HTML::FormFu for details of Filters, Constraints, Inflators, Validators and Transformers.

METHODS

name

For field element, this value is used as the name attribute which the field's value is associated with.

For all elements, the "name" value can be useful for identifying and retrieving specific elements.

is_field

Return Value: boolean

Returns true or false depending on whether the element is a logical form-field.

This is used by "get_fields" in HTML::FormFu.

BUILDING AN ELEMENT

load_config_file

See "load_config_file" 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 originally used to create the element.

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".

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"" in " keys.

id

Arguments: [$id]

Return Value: $id

Get or set the element's DOM id.

Default Value: none

RENDERING

filename

This value identifies which template file should be used by "xhtml" in HTML::FormFu::Render::base to render the element.

multi_filename

This value identifies which template file should be used to render the element when the element is within a multi element.

This value is generally either multi_ltr or multi_rtl depending on whether the field and label should be displayed from left-to-right or right-to-left.

prepare_id

Arguments: $render

See "prepare_id" in HTML::FormFu::Element::field for details.

prepare_attrs

Arguments: $render

See "prepare_attrs" in HTML::FormFu::Element::field for details.

render

Return Value: $render_object

Returns a $render object which can either be printed, or used for more advanced custom rendering.

Using an $element object in string context (for example, printing it) automatically calls "render".

The default base-class of the returned render object is HTML::FormFu::Render::Element.

INTROSPECTION

parent

Returns the HTML::FormFu::Element or HTML::FormFu object that this element is attached to.

form

Returns the HTML::FormFu object that this element is attached to.

clone

See "clone" in HTML::FormFu for details.

ADVANCED CUSTOMISATION

render_class

See "render_class" in HTML::FormFu for details.

render_class_prefix

See "render_class_prefix" in HTML::FormFu for details.

render_class_suffix

See "render_class_suffix" in HTML::FormFu for details.

render_class_args

See "render_class_args" in HTML::FormFu for details.

render_method

See "render_method" in HTML::FormFu for details.

CORE FORM FIELDS

HTML::FormFu::Element::button
HTML::FormFu::Element::checkbox
HTML::FormFu::Element::content_button
HTML::FormFu::Element::file
HTML::FormFu::Element::hidden
HTML::FormFu::Element::image
HTML::FormFu::Element::password
HTML::FormFu::Element::radiogroup
HTML::FormFu::Element::radio
HTML::FormFu::Element::reset
HTML::FormFu::Element::select
HTML::FormFu::Element::submit
HTML::FormFu::Element::textarea
HTML::FormFu::Element::text

OTHER CORE ELEMENTS

HTML::FormFu::Element::blank
HTML::FormFu::Element::block
HTML::FormFu::Element::fieldset
HTML::FormFu::Element::hr
HTML::FormFu::Element::multi
HTML::FormFu::Element::non_block
HTML::FormFu::Element::simple_table

ELEMENT BASE CLASSES

The following are base classes for other elements, and shouldn't be used directly.

HTML::FormFu::Element::field
HTML::FormFu::Element::group
HTML::FormFu::Element::input

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.