use strict; use warnings; use Test::More; use HTML::FormHandler::Test; { package Test::Form; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; has_field 'comedians' => ( type => 'Multiple', widget => 'CheckboxGroup', options => [ { value => 'keaton', label => 'Buster Keaton'}, { value => 'chaplin', label => 'Charly Chaplin'}, { value => 'laurel & hardy', label => 'Stan Laurel & Oliver Hardy' }, ], ); has_field 'fruit' => ( type => 'Multiple', widget => 'CheckboxGroup', tags => { inline => 1 }, options => [ { value => 1, label => 'Apples' }, { value => 2, label => 'Oranges' }, { value => 3, label => 'Pears' }, ], ); has_field 'optgroup' => ( type => 'Multiple', widget => 'CheckboxGroup', ); sub options_optgroup { ( { group => 'First Group', options => [ { value => 1, label => 'One' }, { value => 2, label => 'Two' }, { value => 3, label => 'Three' }, ], attributes => { class => 'group1' }, }, { group => 'Second Group', options => [ { value => 4, label => 'Four' }, { value => 5, label => 'Five' }, { value => 6, label => 'Six' }, ], label_attributes => { class => 'group2' }, }, ) } } my $form = Test::Form->new; $form->process; my $expected = '