[html-formfu] Problem with form generation/rendering
Mario Minati
mario.minati at googlemail.com
Thu Oct 11 20:42:35 GMT 2007
On Friday 05 October 2007 10:17:19 Carl Franks wrote:
> 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 :)
>
I went a little bit into this and that the real parsing of the path and
filename is done in Template::Provider. But I don't think it's a good idea to
copy it's checking code, that would be way to complex.
On the other hand I found out, that TT throws an
Template::Constants::ERROR_FILE if it has problems with a file.
When I read Template and Template::Base correct it should return an error code
on any problems.
I submitted a corrected version of Render::base to SVN.
Could someone check if it is working for Template::Alloy? I didn't have the
opportunity to check that.
Greets,
Mario
More information about the HTML-FormFu
mailing list