NAME

Valiant::HTML::Formbuilder::Checkbox - A custom formbuilder for checkbox content

SYNOPSIS

$fb->collection_checkbox({person_roles => 'role_id'}, $roles, id=>'label', sub {
  my $fb_roles = shift;
  $fb_roles->checkbox({class=>'form-check-input'});
  $fb_roles->label({class=>'form-check-label'});
});

DESCRIPTION

This is a custom subclass of Valiant::HTML::FormBuilder that modifies the label and checkbox method so that it is already aware of the the field values, if its checked or not, etc. It also addes three methods, text which is the text value of the collection; value, which is its value and checked which is a boolean indicated if the checkbox is 'checked' or not.

Generally you use this inside a collection_checkbox when you want to have some custom HTML and attributes on the checkbox and label elements (typically for styling as in the example shown.

Chances are you won't use this stand alone but rather from inside a parent builder.

SEE ALSO

Valiant::HTML::FormBuilder

AUTHOR

See Valiant

COPYRIGHT & LICENSE

See Valiant