NAME
Valiant::HTML::FormBuilder::RadioButton - A custom formbuilder for radio button content
SYNOPSIS
$fb_profile->collection_radio_buttons('state_id', $states, id=>'name', +{ errors_classes=>'is-invalid'}, sub (
my $fb_state = shift;
$fb_state->radio_button(+{class=>"form-check-input"});
$fb_state->label(+{class=>"form-check-label"});
});
DESCRIPTION
This is a custom subclass of Valiant::HTML::FormBuilder that modifies the label
and radio_button
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_radio_button
when you want to have some custom HTML and attributes on the radio button 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
AUTHOR
See Valiant
COPYRIGHT & LICENSE
See Valiant