nybble_1 has asked for the wisdom of the Perl Monks concerning the following question:
Corresponding form code:my $formPhone = MyApp::Form::Phone->new; $formPhone->process(item => $c->model('MyDb')->find(1), params => $c->request->params); $c->stash->{formPhone} = $formPhone;
When a ResultSet is passed in:use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; with 'HTML::FormHandler::Render::Table'; has_field 'area_code' => (type => 'Text', label => 'Area Code', +required => 1, css_class=>'required_field'); has_field 'number' => (type => 'Text', label => 'Home Phone', re +quired => 1, css_class=>'required_field'); __PACKAGE__->meta->make_immutable; 1;
Corresponding (approximation) repeatable form code :my $formPhone = MyApp::Form::Phone->new; $formPhone->process(item => $c->model('MyDb')->search(...)->all, params => $c->request->params); $c->stash->{formPhone} = $formPhone;
the code blows up with:use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; with 'HTML::FormHandler::Render::Table'; has_field 'phone' => ( type => 'Repeatable' ); has_field 'phone.id' => ( type => 'PrimaryKey' ); has_field 'phone.area_code' => (type => 'Text', label => 'Area Code', +required => 1, css_class=>'required_field'); has_field 'phone.number' => (type => 'Text', label => 'Home Phone', re +quired => 1, css_class=>'required_field'); __PACKAGE__->meta->make_immutable; 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::FormHandler, Repeatables and DBIC ResultSet
by actualize (Monk) on Apr 10, 2010 at 20:56 UTC |