![]() |
![]()
| ![]() |
![]()
NAMEHTML::FormFu::Element - Element Base ClassVERSIONversion 2.07SYNOPSIS--- 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 DESCRIPTIONElements are the basic building block of all forms. Elements may be logical form-fields, blocks such as "div"s and "fieldset"s, non-blocks such as "hr"s 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. METHODSnameFor 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_fieldReturn Value: booleanReturns "true" or "false" depending on whether the element is a logical form-field. This is used by "get_fields" in HTML::FormFu. BUILDING AN ELEMENTload_config_fileArguments: $filenameArguments: \@filenames Populate an element using a config file: --- elements: - type: Block load_config_file: 'elements.yml' See "load_config_file" in HTML::FormFu for further details. load_config_filestemArguments: $filestemArguments: \@filestems Like "load_config_file", but you shouldn't include the file extension in the passed string. This allows you to change your config-file type, without having to change the code that loads the files. config_file_pathArguments: $directory_name"config_file_path" defines where configuration files will be searched for, if an absolute path is not 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 up to the form, searching for a defined value. config_callbackSee "config_callback" in HTML::FormFu for details.populateSee "populate" in HTML::FormFu for details.stashSee "stash" in HTML::FormFu for details.typeReturns the "type" argument originally used to create the element.CHANGING DEFAULT BEHAVIOURrender_processed_valueSee "render_processed_value" in HTML::FormFu for details.force_errorsSee "force_errors" in HTML::FormFu for details.ELEMENT ATTRIBUTESSee specific element types for which tag attributes are added to.attributesattrsArguments: [%attributes]Arguments: [\%attributes] Return Value: $form See "attributes" in HTML::FormFu for details. "attrs" is an alias for "attributes". attributes_xmlattrs_xmlSee "attributes_xml" in HTML::FormFu for details."attrs_xml" is an alias for "attributes_xml". add_attributesadd_attrsArguments: [%attributes]Arguments: [\%attributes] Return Value: $form See "add_attributes" in HTML::FormFu for details. "add_attrs" is an alias for "add_attributes". add_attributes_xmladd_attrs_xmlSee "add_attributes_xml" in HTML::FormFu for details."add_attrs_xml" is an alias for "add_attributes_xml". del_attributesdel_attrsArguments: [%attributes]Arguments: [\%attributes] Return Value: $form See "del_attributes" in HTML::FormFu for details. "del_attrs" is an alias for "del_attributes". del_attributes_xmldel_attrs_xmlSee "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. idArguments: [$id]Return Value: $id Get or set the element's DOM id. Default Value: none MODEL / DATABASE INTERACTIONSee HTML::FormFu::Model for further details and available models.model_configArguments: \%configRENDERINGfilenameThis value identifies which template file should be used by "render" to render the element.prepare_idArguments: $renderSee "prepare_id" in HTML::FormFu::Role::Element::Field for details. prepare_attrsArguments: $renderSee "prepare_attrs" in HTML::FormFu::Role::Element::Field for details. renderReturn Value: $stringINTROSPECTIONparentReturns the block element or form object that this element is attached to.get_parentArguments: \%optionsmy $repeatable = $field->get_parent({ type => 'Repeatable' }); Traverses the parent hierarchy, returning the first parent that matches the supplied options. formReturns the HTML::FormFu object that the constraint's field is attached to.cloneSee "clone" in HTML::FormFu for details.ADVANCED CUSTOMISATIONtt_argsSee "tt_args" in HTML::FormFu for details.render_methodSee "render_method" in HTML::FormFu for details.CORE FORM FIELDS
OTHER CORE ELEMENTS
ELEMENT BASE CLASSESThe following are base classes for other elements, and generally needn't be used directly.
REMOVED METHODSdbHas been removed; use "default_args" instead.AUTHORCarl Franks, "cfranks@cpan.org"LICENSEThis library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.AUTHORCarl Franks <cpan@fireartist.com>COPYRIGHT AND LICENSEThis 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.
|