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 $params = { comedians => [ 'chaplin', 'laurel & hardy' ], }; $form->process($params); $rendered = $form->field('comedians')->render; $expected = '<div> <label for="comedians">Comedians</label> <label class="checkbox" for="comedians.0"> <input type="checkbox" value="keaton" name="comedians" id="comedians.0" /> Buster Keaton </label> <label class="checkbox" for="comedians.1"> <input type="checkbox" value="chaplin" name="comedians" id="comedians.1" checked="checked" /> Charly Chaplin </label> <label class="checkbox" for="comedians.2"> <input type="checkbox" value="laurel & hardy" name="comedians" id="comedians.2" checked="checked" /> Stan Laurel & Oliver Hardy </label> </div>'; is_html( $rendered, $expected, 'output from checkbox group' );
is_html( $rendered, $expected, 'output from checkbox group with option group attributes' );
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 32:
Unknown directive: =comment
- Around line 91:
Unknown directive: =comment
- Around line 135:
Unknown directive: =comment