NAME

HTML::Widget::Element::Select - Select Element

SYNOPSIS

my $e = $widget->element( 'Select', 'foo' );
$e->comment('(Required)');
$e->label('Foo');
$e->size(23);
$e->options( foo => 'Foo', bar => 'Bar' );
$e->selected(qw/foo bar/);

DESCRIPTION

Select Element.

An implicit In Constraint is automatically added to every Select element to ensure that only key values from the "options" list are considered valid.

METHODS

comment

Add a comment to this Element's label.

label

This label will be placed next to your Element.

size

If set to 1, the select element is displayed as a pop-up menu, otherwise the element is displayed as a list box, with the size determining the display height in rows. The default size is 1.

multiple

$widget->element( 'Select', 'foo' )->multiple( 1 );

If the multiple attribute is set, the select element is rendered as a list box, and the user may select multiple options.

If the size is not set, the default size (height) is the number of elements. If the size is set to 1, the element is rendered as a pop-up menu.

options

A list of options in key => value format. Each key is the unique id of an option tag, and its corresponding value is the text displayed in the element.

selected

value (alias)

A list of keys (unique option ids) which will be pre-set to "selected". Can also be addressed as value for consistency with the other elements

$self->prepare( $widget, $value )

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

$self->containerize( $widget, $value, $errors )

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.