Form::Factory::Control::Checkbox - the checkbox control


Form-Factory documentation Contained in the Form-Factory distribution.

Index


Code Index:

NAME

Top

Form::Factory::Control::Checkbox - the checkbox control

VERSION

Top

version 0.020

SYNOPSIS

Top

  has_control yes_no_box => (
      control => 'checkbox',
      options => {
          true_value  => 'Yes',
          false_value => 'No',
          is_true     => 1,
      },
  );

DESCRIPTION

Top

This represents a toggle button, typically displayed as a checkbox. This control implements Form::Factory::Control, Form::Factory::Control::Role::BooleanValue, Form::Factory::Control::Role::Labeled, Form::Factory::Control::Role::ScalarValue.

METHODS

Top

default_isa

Boolean values default to Bool.

AUTHOR

Top

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Top


Form-Factory documentation Contained in the Form-Factory distribution.
package Form::Factory::Control::Checkbox;
BEGIN {
  $Form::Factory::Control::Checkbox::VERSION = '0.020';
}
use Moose;

with qw(
    Form::Factory::Control
    Form::Factory::Control::Role::BooleanValue
    Form::Factory::Control::Role::Labeled
);

has '+value' => (
    isa       => 'Str',
);

has '+default_value' => (
    isa       => 'Str',
    lazy      => 1,
    default   => sub { shift->false_value },
);

use constant default_isa => 'Str';

1;