[Catalyst] Trying out FormHandler, running into "maketext" error

will trillich will.trillich at serensoft.com
Sun Nov 21 06:43:59 GMT 2010


Hi Catalystas --

We're trying a new project, this time using FormHandler, and there's
something we obviously don't have right.

In the controller we define the OrgForm class (which we borrowed from the
truly awesome InstantCRUD.pl output),

{
    package *MyApp::Controller::Org::OrgForm*;
    use HTML::FormHandler::Moose;
    extends 'HTML::FormHandler::Model::DBIC';
    with 'HTML::FormHandler::Render::Table';

    has '+item_class' =3D> ( default =3D> 'Org' );
...
}

Then we refer to it thus:

sub org :Local :Args(0) {
    my ( $self, $c ) =3D @_;

    my %params =3D %{ $c->req->params };
    my $org =3D $c->model('MyApp::Org')->find_or_new( {id =3D> $params{id} =
|| 1}
); # default to org #1 for now
    my $form =3D *MyApp::Controller::Org::OrgForm*->new(
        item   =3D> $org,
        params =3D> \%params,
    );
    $c->stash->{form} =3D $form;

}

WIth *[% form.render %]* in the template, we see this message in the
browser:

undef error - Unable to do maketext on: at
/usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15.

When single-stepping via the Perl debugger, *
$form->field('name')->result->value* returns the proper name of org#1 just
as expected, so pulling a database record and stuffing it into the form is
working just fine. But it won't render the HTML. (We also tried converting
NULL values in the database fields to empty strings, no difference.)

What did we miss?

=3D=3D=3D=3D=3D

Catalyst v5.8.0029
HTML::FormHandler v0.32001
Moose v1.2

Here's the initial debug-listing output form the command line:


Use of uninitialized value $message[0] in concatenation (.) or string at
/usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. at
/usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15

 HTML::FormHandler::I18N::__ANON__[/usr/local/share/perl/5.10.0/HTML/FormHa=
ndler/I18N.pm:16]('No
handle/phrase at /usr/share/perl/5.10/Locale/Maketext.pm l...') called at /u
sr/local/share/perl/5.10.0/Try/Tiny.pm line 100
        Try::Tiny::try('CODE(0xcc64058)', 'Try::Tiny::Catch=3DREF(0xcc63f78=
)')
called at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 16

 HTML::FormHandler::I18N::maketext('HTML::FormHandler::I18N::en_us=3DHASH(0=
xcc6fb38)',
undef) called at
/usr/local/share/perl/5.10.0/HTML/FormHandler/TraitFor/I18N.pm line 57

 HTML::FormHandler::TraitFor::I18N::_localize('MooseX::Traits::__ANON__::SE=
RIAL::12=3DHASH(0xcb69690)',
undef) called at /usr/local/share/perl/5.10.0/HTML/FormHandler/Render/S
imple.pm line 393

 HTML::FormHandler::Render::Simple::render_submit('MyApp::Controller::Org::=
OrgForm=3DHASH(0xc733818)',
'MooseX::Traits::__ANON__::SERIAL::12=3DHASH(0xcb69690)') called at /usr/l
ocal/share/perl/5.10.0/HTML/FormHandler/Render/Simple.pm line 185

 HTML::FormHandler::Render::Simple::render_field('MyApp::Controller::Org::O=
rgForm=3DHASH(0xc733818)',
'MooseX::Traits::__ANON__::SERIAL::12=3DHASH(0xcb69690)') called at /usr/lo
cal/share/perl/5.10.0/HTML/FormHandler/Render/Table.pm line 31

 HTML::FormHandler::Render::Table::render('MyApp::Controller::Org::OrgForm=
=3DHASH(0xc733818)')
called at /home/will/projects/perl-mvc/MyApp/root/src/admin/org.tt2 line 6
[etc]

-- =

Failure is not important. How you overcome it, is.
-- Nick Vujicic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20101121/29216=
9ca/attachment.htm


More information about the Catalyst mailing list