[Catalyst] Form Module Dichotomy

Carl Franks fireartist at gmail.com
Fri Mar 23 09:35:27 GMT 2007


On 22/03/07, Doran L. Barton <fozz at iodynamics.com> wrote:
> I am currently developing my first app using C:C:FormBuilder too, having
> done previous Catalyst projects with HTML::Widget. I think FormBuilder may
> become the de facto way to develop Catalyst apps in the future, especially
> seeing there is a DBIx::Class::FormBuilder module on the horizon that will
> marry FormBuilder to DBIx::Class like DBIx::Class::HTMLWidget does for
> HTML::Widget.

Well, if mts has anything to say about it, it'll be Reaction that
becomes the Cat de-facto ;)

> Have I missed something? What's FormFu?

Discussion of FormFu has generally been limited to the html-widget
mailing list so far.
FormFu is similar to html-widget, but tries to get everything right this time ;)
It's main selling points are:
* You can define your forms using external config files (using any
format supported by Config::Any)
* Instead of having a simple idea of 'constraint' - it has several
stages that can process each form field.
Filters -> Constraints -> Inflators -> Validators -> Transformers.
Filters are intended to do basic cleanup of data input, such as
removing trailing whitespace, or removing spaces in a creditcard
number.
Constraints are low-level data validation, such as, is this an
integer, is this in bounds, etc.
Inflators are similar to DBIC's - they expand the input into an object
of some sort, so there's one which creates a DateTime object, and
there's one which turns a file upload into an Imager object.
Validators are for 'business logic' - more complex validation,
possibly relating multiple fields, which will usually require a custom
class created for each check. The only validator written as of yet is
Imager::Size which checks a picture's pixel size is within bounds.
And Transformers are to manipulate the (possible inflated) input data
before using it. The ony transformer written so far is Imager, to edit
Imager objects (scale, crop, etc).
There are also Deflators, so you can pass $field->default($value) an
object and make sure its value is printed properly.
* Instead of using HTML::Element to generate the xhtml, it uses TT
templates. Every project will have it's own copy of the template
files, so you can customise them if you wish.
* It's gotten rid of html-widget's seperate $result object -
simplifying usage greatly.
* Integration with Catalst and DBIx::Class

See `svn log` for more - there's lot's there!
The code is currently available from:
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu/
http://html-formfu.googlecode.com/svn/trunk/DBIx-Class-FormFu/
http://html-formfu.googlecode.com/svn/trunk/Catalyst-Controller-HTML-FormFu/
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Dojo/
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Imager/

I've started adding some TODO's to the issue tracker:
http://code.google.com/p/html-formfu/issues/list
What would be most helpful though for anyone wishing to help, would be
documentation, as what's there is quite out-of-date.

Cheers,
Carl



More information about the Catalyst mailing list