NAME

HTML::Widget::Element - Element Base Class

SYNOPSIS

my $e = $widget->element( $type, $name );
$e->attributes( { class => 'foo' } );
$e->name('bar');
$e->class('foo');

DESCRIPTION

Element Base Class.

METHODS

new

$self->container($attributes)

Creates a new $container_class. Defaults to HTML::Widget::Container.

$self->id($widget)

Creates a element id.

$self->init($widget)

Called once when process() gets called for the first time.

$self->mk_error( $w, $errors )

Creates a new HTML::Widget::Error.

$self->mk_input( $w, $attrs, $errors )

Creates a new input tag.

$self->mk_tag( $w, $tagtype, $attrs, $errors )

Creates a new tag.

$self->mk_label( $w, $name )

Creates a new label tag.

name($name)

Contains the element name.

passive($passive)

Defines if element gets automatically rendered.

$self->prepare($widget)

Called whenever $widget->process() gets called, before $element->process().

$self->process($params, $uploads)

Called whenever $widget->process()

Returns an arrayref of HTML::Widget::Error objects.

$self->containerize

Containerize the element, label and error for later rendering. Uses HTML::Widget::Container by default, but this can be over-ridden on a class or instance basis via container_class.

$self->container_class($class)

Contains the class to use for contain the element which then get rendered. Defaults to HTML::Widget::Container. container_class can be set at a class or instance level:

HTML::Widget::Element->container_class('My::Container'); 
# Override default to custom class

HTML::Widget::Element::Password->container_class(undef); 
# Passwords use the default class
 
$w->element('Textfield')->name('foo')->container_class->('My::Other::Container'); 
# This element only will use My::Other::Container to render

AUTHOR

Sebastian Riedel, sri@oook.de

LICENSE

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.