---
name: "HTML::FormFu::Element::_Field"
section: "3pm"
platform: "linux"
package: "libhtml-formfu-perl"
version: "0.07002-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/HTML::FormFu::Element::_Field"
---

# HTML::FormFu::Element::\_Field(3pm)

base class for all form-field elements

## NAME

HTML::FormFu::Element::\_Field - base class for all form-field elements

## DESCRIPTION

Base-class for all form-field elements.

## METHODS

### default

Set the form-field's default value.

### default\_xml

Arguments: `$string`

If you don't want the default value to be XML-escaped, use the  "default\_xml" method instead of "default".

### default\_loc

Arguments: `$localization_key`

Set the default value using a L10N key.

### value

For most fields, "value" is an alias for "default".

For the HTML::FormFu::Element::Checkbox and  HTML::FormFu::Element::Radio elements, "value" sets what the value of  the field will be if it is checked or selected. If the "default" is the  same as the "value", then the field will be checked or selected when  rendered.

For the HTML::FormFu::Element::Radiogroup and  HTML::FormFu::Element::Select elements, the "value" is ignored:  values or  options provides the equivalent  function.

### value\_xml

Arguments: `$string`

If you don't want the value to be XML-escaped, use the "value\_xml"  method instead of "value".

### value\_loc

Arguments: `$localization_key`

Set the value using a L10N key.

### non\_param

Arguments: bool

If true, values for this field are never returned by "params" in HTML::FormFu,  "param" in HTML::FormFu and "valid" in HTML::FormFu.

This is useful for Submit buttons, when you only use its value as an  indicator.

Default Value: false

### label

Set a label to communicate the purpose of the form-field to the user.

### label\_xml

Arguments: `$string`

If you don't want the label to be XML-escaped, use the "label\_xml"  method instead of "label".

### label\_loc

Arguments: `$localization_key`

Set the label using a L10N key.

### comment

Set a comment to be displayed along with the form-field.

### comment\_xml

Arguments: `$string`

If you don't want the comment to be XML-escaped, use the "comment\_xml"  method instead of "comment".

### comment\_loc

Arguments: `$localization_key`

Set the comment using a L10N key.

### container\_tag

Set which tag-name should be used to contain the various field parts (field,  label, comment, errors, etc.).

Default Value: 'div'

### javascript

Arguments: \[$javascript\]

If set, the contents will be rendered within a `"script"` tag, within the  field's container.

### retain\_default

If "retain\_default" is true and the form was submitted, but the field  didn't have a value submitted, then when the form is redisplayed to the user  the field will have its value set to its default value, rather than the  usual behaviour of having an empty value.

Default Value: `"false"`

### force\_default

If "force\_default" is true and the form was submitted, and the field has a default/value set, then when the form is redisplayed to the user the field will have its value set to its default value.

If the default value is being changed after FormFu-\>process is being called the later default value is respected for rendering, \*but\* nevertheless the input value doesn't respect that, it will remain the first value.

Default Value: `"false"`

### default\_empty\_value

Designed for use by Checkbox fields. Normally if a checkbox is not checked, no value is submitted for that field. If `"default_empty_value"` is true, the Checkbox field is given an empty value during process. Please note that, with this setting, the checkbox gets an EMPTY value (as opposed to no value at all without enabling it), NOT the default value assigned to the element (if any).

Default Value: `"false"`

### reverse\_single

If true, then the field's label should be rendered to the right of the field control.  (When the field is used within a Multi block, the position of the label is controlled by the "reverse\_multi" option instead.)

The default value is `"false"`, causing the label to be rendered to the left of the field control (or to be explicit: the markup for the label comes before the field control in the source).

Exception: If the label tag is 'legend', then the reverse\_single attribute is ignored; the legend always appears as the first tag within the container tag.

Default Value: `"false"`

### reverse\_multi

If true, then when the field is used within a  Multi block, the field's label should be  rendered to the right of the field control.

The default value is `"false"`, causing the label to be rendered to the left of the field control (or to be explicit: the markup for the label comes  before the field control in the source).

Default Value: `"false"`

### repeatable\_count

Only available for fields attached to a Repeatable element, after `$repeatable`-\>repeat($count)  has been called.

The value is inherited from "repeatable\_count" in HTML::FormFu::Element::Repeatable.

### clone

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

### deflators

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

### deflator

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

## ATTRIBUTES

### comment\_attributes

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

Attributes added to the comment container.

### comment\_attributes\_xml

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

If you don't want the values to be XML-escaped, use the  "comment\_attributes\_xml" method instead of "comment\_attributes".

### add\_comment\_attributes

### add\_comment\_attrs

See "add\_attributes" in HTML::FormFu for details.

### add\_comment\_attributes\_xml

### add\_comment\_attrs\_xml

See "add\_attributes\_xml" in HTML::FormFu for details.

### add\_comment\_attributes\_loc

### add\_comment\_attrs\_loc

See "add\_attributes\_loc" in HTML::FormFu for details.

### del\_comment\_attributes

### del\_comment\_attrs

See "del\_attributes" in HTML::FormFu for details.

### del\_comment\_attributes\_xml

### del\_comment\_attrs\_xml

See "del\_attributes\_xml" in HTML::FormFu for details.

### del\_comment\_attributes\_loc

### del\_comment\_attrs\_loc

See "del\_attributes\_loc" in HTML::FormFu for details.

### container\_attributes

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

Arguments added to the field's container.

### container\_attributes\_xml

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

If you don't want the values to be XML-escaped, use the  "container\_attributes\_xml" method instead of "container\_attributes".

### add\_container\_attributes

### add\_container\_attrs

See "add\_attributes" in HTML::FormFu for details.

### add\_container\_attributes\_xml

### add\_container\_attrs\_xml

See "add\_attributes\_xml" in HTML::FormFu for details.

### add\_container\_attributes\_loc

### add\_container\_attrs\_loc

See "add\_attributes\_loc" in HTML::FormFu for details.

### del\_container\_attributes

### del\_container\_attrs

See "del\_attributes" in HTML::FormFu for details.

### del\_container\_attributes\_xml

### del\_container\_attrs\_xml

See "del\_attributes\_xml" in HTML::FormFu for details.

### del\_container\_attributes\_loc

### del\_container\_attrs\_loc

See "del\_attributes\_loc" in HTML::FormFu for details.

### label\_attributes

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

Attributes added to the label container.

### label\_attributes\_xml

Arguments: \[%attributes\]

Arguments: \[\\%attributes\]

If you don't want the values to be XML-escaped, use the  "label\_attributes\_xml" method instead of "label\_attributes".

### add\_label\_attributes

### add\_label\_attrs

See "add\_attributes" in HTML::FormFu for details.

### add\_label\_attributes\_xml

### add\_label\_attrs\_xml

See "add\_attributes\_xml" in HTML::FormFu for details.

### add\_label\_attributes\_loc

### add\_label\_attrs\_loc

See "add\_attributes\_loc" in HTML::FormFu for details.

### del\_label\_attributes

### del\_label\_attrs

See "del\_attributes" in HTML::FormFu for details.

### del\_label\_attributes\_xml

### del\_label\_attrs\_xml

See "del\_attributes\_xml" in HTML::FormFu for details.

### del\_label\_attributes\_loc

### del\_label\_attrs\_loc

See "del\_attributes\_loc" in HTML::FormFu for details.

## FORM LOGIC AND VALIDATION

### filters

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

### filter

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

### constraints

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

### constraint

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

### inflators

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

### inflator

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

### validators

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

### validator

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

### transformers

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

### transformer

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

## CSS CLASSES

### auto\_id

See "auto\_id" in HTML::FormFu for details.

### auto\_label

See "auto\_label" in HTML::FormFu for details.

### auto\_error\_class

See "auto\_error\_class" in HTML::FormFu for details.

### auto\_error\_message

See "auto\_error\_message" in HTML::FormFu for details.

### auto\_constraint\_class

See "auto\_constraint\_class" in HTML::FormFu for details.

### auto\_inflator\_class

See "auto\_inflator\_class" in HTML::FormFu for details.

### auto\_validator\_class

See "auto\_validator\_class" in HTML::FormFu for details.

### auto\_transformer\_class

See "auto\_transformer\_class" in HTML::FormFu for details.

## RENDERING

### field\_filename

The template filename to be used for just the form field - not including the  display of any container, label, errors, etc.

Must be set by more specific field classes.

### label\_filename

The template filename to be used to render the label.

Must be set by more specific field classes.

## ERROR HANDLING

### get\_errors

See "get\_errors" in HTML::FormFu for details.

### add\_error

### clear\_errors

See "clear\_errors" in HTML::FormFu for details.

## INTROSPECTION

### get\_deflators

See "get\_deflators" in HTML::FormFu for details.

### get\_deflator

See "get\_deflator" in HTML::FormFu for details.

### get\_filters

See "get\_filters" in HTML::FormFu for details.

### get\_filter

See "get\_filter" in HTML::FormFu for details.

### get\_constraints

See "get\_constraints" in HTML::FormFu for details.

### get\_constraint

See "get\_constraint" in HTML::FormFu for details.

### get\_inflators

See "get\_inflators" in HTML::FormFu for details.

### get\_inflator

See "get\_inflator" in HTML::FormFu for details.

### get\_validators

See "get\_validators" in HTML::FormFu for details.

### get\_validator

See "get\_validator" in HTML::FormFu for details.

### get\_transformers

See "get\_transformers" in HTML::FormFu for details.

### get\_transformer

See "get\_transformer" in HTML::FormFu for details.

### get\_errors

See "get\_errors" in HTML::FormFu for details.

### clear\_errors

See "clear\_errors" in HTML::FormFu for details.

## SEE ALSO

Base-class for HTML::FormFu::Element::\_Group,  HTML::FormFu::Element::\_Input,  HTML::FormFu::Element::Multi,  HTML::FormFu::Element::ContentButton,  HTML::FormFu::Element::Textarea.

Is a sub-class of, and inherits methods from 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.
