MATSUNO★Tokuhiro > HTML-Shakan-0.16 > HTML::Shakan::Field

Download:
HTML-Shakan-0.16.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source   Latest Release: HTML-Shakan-2.00

NAME ^

HTML::Shakan::Field - base class for field object

DESCRIPTION ^

This is a base class for filed object.

ATTRIBUTES ^

id

the 'id' attribute for the html elements.

name

the 'name' attribute for the html elements.

value

the 'value' attribute for the html elements.

filters: ArrayRef[Str]

This is parameter filters in arrayref.

For example, following field removes white space from parameter value in head and end.

        TextField(
                name     => 'f',
                required => 1,
                filters  => [qw'WhiteSpace']
        ),
widget

type of widget.

attr

hashref about the miscellaneous attributes.

label

label for this field.

required

is this field's value required?

custom_validation
    TextField(
        name => 'id',
        custom_validation => sub {
            my ($form, $field) = @_;
            if (is_reserved_id($form->param($field->name))) {
                $form->set_error($field->name() => 'reserved');
            }
        }
    )

You can register custom validation callback.

The callback function takes two arguments.

$form

This is a instance of HTML::Shakan. You can take query parameter value by this object.

$field

The field object itself.

constraints

constraints for FormValidator::Lite.

AUTHORS ^

tokuhirom

syntax highlighting: