XXX: check() id-related improvements + tests
[perl/html-form-simple.git] / lib / HTML / Form / Simple.pm
index 58e8753498f13ddcbdac4169f32594c21c58081a..f96149f0b5f555895dc309b58108e538160bb042 100644 (file)
@@ -213,6 +213,8 @@ sub check {
                }
        }
        exists $rows->[$_]->{value} or $rows->[$_]->{value} = $_ + 1 for 0 .. $#$rows;
+       $rows->[0]->{id} = $attr->{id} || $rows->[0]->{name} || $attr->{name} || $name #XXX: //
+               if ref $label ne 'ARRAY' and defined $rows->[0] and not defined $rows->[0]->{id};
 
        $self->select($name, $rows, {%$attr, type => 'checkbox'});
 }