NAME

HTML::Widget::Plugin::Select - a widget for selection from a list

SYNOPSIS

$widget_factory->select({
  id      => 'the-selector', # if no name attr given, defaults to id value
  value   => 10,
  options => [
    [  0 => "Zero" ],
    [  5 => "Five" ],
    [ 10 => "Ten"  ],
  ],
});

DESCRIPTION

This plugin provides a select-from-list widget.

METHODS

provided_widgets

This plugin provides the following widgets: select

select

This method returns a select-from-list widget.

In addition to the generic HTML::Widget::Plugin attributes, the following are valid arguments:

disabled

If true, this option indicates that the select widget can't be changed by the user.

ignore_invalid

If this is given and true, an invalid value is ignored instead of throwing an exception.

options

This may be an arrayref of arrayrefs, each containing a value/name pair, or it may be a hashref of values and names.

Use the array form if you need multiple entries for a single value or if order is important.

value

If this argument is given, the option with this value will be pre-selected in the widget's initial state.

An exception will be thrown if more or less than one of the provided options has this value.

build

my $widget = $class->build($factory, \%arg)

This method does the actual construction of the widget based on the args set up in the exported widget-constructing call. It's here for subclasses to exploit.

make_option

my $option = $class->make_option($factory, $value, $name, $arg);

This method constructs the HTML::Element option element that will represent one of the options that may be put into the select box. This is here for subclasses to exploit.

validate_value

This method checks whether the given value option is valid. See "select" for an explanation of its default rules.

AUTHOR

Ricardo SIGNES <rjbs @ cpan.org>

COPYRIGHT

Copyright (C) 2005-2007, Ricardo SIGNES. This is free software, released under the same terms as perl itself.