NAME

Form::Toolkit::Field - A field for JCOM::Form s

id

Returns a unique id of this field in the space of all forms in the process.

Usage:

my $id = $this->id();

fast_clone

Returns a fast clone of this field.

value_clone

Returns a shallow clone of the contained value (can be undef)

value_struct

Returns the string value of this field.

set_placeholder

Chainable placeholder(..);

Placeholder. This is an extra hint, like an example of what to enter for users. Very useful for HMTL5 interfaces.

set_help

Chainable help() method.

set_label

Chainable label method.

add_error

Adds an error string to this field.

has_errors

Returns the number of errors in this form.

validate

Does nothing. Can be extended by roles.

clear

Resets this field value and errors

add_role

Adds a Subrole of Form::Toolkit::FieldRole or a custom defined FormRole. Additionnaly, you can provide new parameters if the role you're applying requires some mandatory attributes.

Returns the field so you can chain calls.

Usage:

$this->add_role('Mandatory')
        ->add_role('+My::App::FieldRole::Whatever');
          ->add_role('RegExpMatch', { regexp_match => qr/^[A-Z]+$/ });

roles_names

Returns an array of Roles this field implements.

does_role

Returns true if this field does the given role.

Usage:

if( $this->does_role('Mandatory') ){
  ...
}


if( $this->does_role('+My::Specific::Role') ){
  ...
}

short_class

Accessor shortcut for meta short class.

Usage:

$this->short_class();