NAME
Form::Sensible::Field::Select - A multiple-choice option field
SYNOPSIS
use Form::Sensible::Field::Select;
my $select_field = Form::Sensible::Field::Select->new(
name => 'bread_type'
accepts_multiple => 0
);
$select_field->add_option('wheat', 'Wheat Bread');
$select_field->add_option('white', 'White Bread');
$select_field->add_option('sour', 'Sourdough Bread');
DESCRIPTION
This Field type allows a user to select one or more options from a provided set of options. This could be rendered as a select box, a radio group or even a series of checkboxes, depending on the renderer and the render_hints provided.
Note that the value returned by a select field will always be an arrayref, even if only a single option was selected.
ATTRIBUTES
'options'
-
An array ref containing the allowed options. Each option is represented as a hash containing a
name
element and avalue
element for the given option. 'accepts_multiple'
-
Does this field allow multiple options to be selected. Defaults to false.
METHODS
set_selection($selected_option,...)
-
Set's the provided option values as selected. If
accepts_multiple
is false, only the first item will be set as selected. add_option($option_value, $option_display_name)
-
Adds the provided value and display name to the set of options that can be selected for this field.
AUTHOR
Jay Kuri - <jayk@cpan.org>
SPONSORED BY
Ionzero LLC. http://ionzero.com/
SEE ALSO
LICENSE
Copyright 2009 by Jay Kuri <jayk@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.