| Form::Factory::Control::SelectMany - the multi-select control |
Form::Factory::Control::SelectMany - the multi-select control
version 0.014
has_control pick_some => (
control => 'select_many',
options => {
label => 'Just select some of these already...",
available_choices => [
Form::Factory::Control::Choice->new('one');
Form::Factory::Control::Choice->new('two');
Form::Factory::Control::Choice->new('three');
],
default_selected_choices => [ qw( one three ) ],
},
);
A select many can be displayed as a multi-select list box or a list of checkboxes.
This control implements the Form::Factory::Control manpage, the Form::Factory::Control::Role::AvailableChoices manpage, the Form::Factory::Control::Role::Labeled manpage, the Form::Factory::Control::Role::ListValue manpage.
This is a list of the default selection.
The selected_choices are stashed.
This is a synonym for value.
This is a synonyms for has_selected_choices.
This is a synonym for default_value.
This is a synonym for has_default_selected_choices.
Returns the value, if set. Failing that, it returns the default_value, if set. Failing that, it returns an empty list.
for my $choice (@{ $self->available_choices }) { if ($control->is_choice_selected($choice)) { # ... } }
This is a helper that is useful while iterating over the available choices in deciding which have been selected.
If more than zero values have been selected, we have a useful value.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
Copyright 2009 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
| Form::Factory::Control::SelectMany - the multi-select control |