[Catalyst] Recommend methods for form handling

John Napiorkowski jjn1056 at yahoo.com
Wed Jan 17 18:40:52 GMT 2007


--- Jim Spath <jspath at pangeamedia.com> wrote:

> I was wondering what the current consensus among
> Catalyst users is about 
> what the best way to approach forms is?
> 
> I started off writing the forms directly into the
> template, validating 
> with FormValidator::Simple, and trying to fill
> values in with FillInForm.
> 
> I really liked FormValidator::Simple alot, and
> writing the forms 
> directly in the template gives designers complete
> control, but I had 
> some trouble with FillInForm and read that it could
> be slow, so I 
> decided to try something else.
> 
> I'm trying out HTML::Widget now, since the Advanced
> CRUD tutorial uses 
> it, and I guess it seems ok, although its validation
> capabilities don't 
> seem as powerful as FormValidator::Simple.  Also, it
> seems like it makes 
> it harder for designers to work with the forms, and
> I'm about its 
> performance.
> 
> I guess I'm just looking for some opinions on which
> methodology to 
> choose.  Performance is probably the biggest
> consideration for me, but 
> validation, ease of development, and allowing for
> designers to easily 
> edit the appearance are all important.
> 
> Thanks!
> Jim

I think FillInForm is quasi depreciated, since it
parses each request and can slow things down quite a
bit.

I'm personally using HTML::Widget with a custom Model
and ActionClass wrapping it's functionality.  You can
give back layout control to the page designers if you
need to (you don't need to use it's built in view
logic).  However I don't have a great example to show
you, I just use the default as_xml output and wrap it
in a custom style sheet.  It generally looks ok, but I
agree that if you need very sophisticated layout needs
you probably can't use the default.

There's a controller and custom actionclass for
Formbuilder (the plugin is depreciated, don't use it)
over at:
http://search.cpan.org/~jcamacho/Catalyst-Controller-FormBuilder-0.02/lib/Catalyst/Controller/FormBuilder.pm

I actually used the plugin version and liked it's
approach of using a config file to create fields and
setup validation.  However I'm not sure how hard it is
to create complex validation logic, like validation
associated with a callback sub.

This looks like a lot of work was put into it to make
it really work well for Catalyst; I'd be inclined to
try if for someone new I was making if I hadn't
already spend so much time on my HTML::Widget
wrappers.

Then there is the Reaction project (search the list
archive for more).  This is more than just for forms
though, but I think it represents more state of the
art thinking.  If you've played with Java Struts and
Tiles and JSF some of the ideas there will seem
familar (at least I think so, but I've been known to
see stuff that wasn't there :)  However the learning
curve is a bit steep since it uses cutting edge Perl
disciplines like Moose for object oriented
programming.  If you have time to spare in the project
it's probably worth a long hard look at.

There are other form systems around but I think that
covers what I've seen people talking about on the
list.

good luck,

John

> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



 
____________________________________________________________________________________
Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097



More information about the Catalyst mailing list