[html-formfu] Problem with form generation/rendering

Carl Franks fireartist at gmail.com
Fri Oct 5 09:17:19 GMT 2007


On 05/10/2007, Will Hawes <wdhawes at gmail.com> wrote:
> On 04/10/2007, Will Hawes <wdhawes at gmail.com> wrote:
> >
> > On 04/10/2007, Carl Franks <fireartist at gmail.com> wrote:
> >
> > > On 04/10/2007, Will Hawes <wdhawes at gmail.com> wrote:
> > > > I'm using the 0.1005 release from CPAN.
> > > >
> > > > This script:
> > > >
> > > > #!/usr/bin/perl -w
> > > > use strict;
> > > > use HTML::FormFu;
> > > > my $form = HTML::FormFu->new;
> > > > $form->element( 'Text', { name => 'test' } );
> > >
> > > That should be either:
> > >     $form->element('Text')->name('test');
> > > or:
> > >     $form->element({ type => 'Text', name => 'text' });
> >
> >
> > Ah, thanks. Should really have guessed the first one as a HTML::Widget
> user :-/
> >
> >
> > > I'm not sure if I want to investigate why the heck you got such a
> > > strange output though...
> >
> >
> > It actually behaves itself once I use the correct syntax for ->element.
> Given that the code in SVN didn't display the same behaviour I'd guess it's
> no longer a problem anyway.
> >
>
> Ah, OK, I see what's happening now. I'm testing the CPAN release in the
> directory tree of a Catalyst app, so the templates are installed at
> root/formfu/ instead of just root/. Hence the renderer can't see them as it
> just searches root by default. Adding
>
> $form->render_class_args( { INCLUDE_PATH => 'root/formfu' } );
>
> sorted it, output is now as expected.
>
> Would it be feasible to throw an error of some sort, mentioning
> render_class_args, if the main form template can't be found under whatever
> dir(s) INCLUDE_PATH is set to? The cause of the strange output is less than
> obvious for a newbie and others will undoubtedly fall foul of this problem
> in future.

That's already in the issue tracker:
http://code.google.com/p/html-formfu/issues/detail?id=14

It now just needs to be done :)

btw, if you're using Catalyst, you'd probably be much better of using
Catalyst::Controller::HTML::FormFu which will automatically set
INCLUDE_PATH for you.

Carl



More information about the HTML-FormFu mailing list