The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Form::Factory::Control::SelectMany - the multi-select control

VERSION

version 0.022

SYNOPSIS

  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 ) ],
      },
  );

DESCRIPTION

A select many can be displayed as a multi-select list box or a list of checkboxes.

This control implements Form::Factory::Control, Form::Factory::Control::Role::AvailableChoices, Form::Factory::Control::Role::Labeled, Form::Factory::Control::Role::ListValue.

METHODS

current_values

This is a synonym for current_value.

selected_choices

This is a synonym for value.

has_selected_choices

This is a synonyms for has_selected_choices.

default_selected_choices

This is a synonym for default_value.

has_default_selected_choices

This is a synonym for has_default_selected_choices.

is_choice_selected

  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.

has_current_value

It has a current value if one or more values are selected.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.