Subject: | Method 'fields' on compound field returns empty list on subsequent instantiation of form object |
Please see attached test. If the form is instantiated more than once the
subsequent instances compound fields do not return their sub-fields.
This particularly affects compound fields in persistent applications.
Subject: | compound_bug_demo.pl |
#!/usr/bin/perl
use strict;
use Test::More tests => 2;
{
package MyForm;
use HTML::FormHandler::Moose;
extends qw(HTML::FormHandler);
has_field 'foo' => (
label => 'Foo',
type => 'Compound',
);
has_field 'foo.bar' => (
label => 'Bar',
type => 'Text',
);
has_field 'foo.baz' => (
label => 'Baz',
type => 'Text',
);
no HTML::FormHandler::Moose;
}
for (1 .. 2) {
my $form = MyForm->new;
is_deeply(
[ map { $_->full_name } @{ $form->field('foo')->fields } ],
[ 'foo.bar', 'foo.baz' ],
'Compound sub fields',
);
}