[html-formfu] Problem with form generation/rendering

Will Hawes wdhawes at gmail.com
Fri Oct 5 09:10:10 GMT 2007


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 =3D HTML::FormFu->new;
> > > $form->element( 'Text', { name =3D> 'test' } );
> >
> > That should be either:
> >     $form->element('Text')->name('test');
> > or:
> >     $form->element({ type =3D> 'Text', name =3D> '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 =3D> '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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20071005/f6=
dae57f/attachment.htm


More information about the HTML-FormFu mailing list