[Catalyst] FormHandler -- pro or con?

Toby Corkindale toby at dryft.net
Mon Dec 13 06:04:28 GMT 2010

On 9 December 2010 19:24, Octavian Rasnita <orasnita at gmail.com> wrote:
>> Using Moose Roles for forms is awesome.
> I also agree with this idea, but the fact that the most used constraints, filters and validators should be also manually specified using Perl code is not so nice.
> It would be nice to have a form processor like H::FF that provides many default HTML elements, constraints, filters and validators, and to be able to create custom elements, constraints, filters and validators using Moose roles, then to specify that those roles are used... using config files.

But.. That's what the custom fields, widgets, roles etc are there for.

Eg. If you need a field that can, say, only accept four characters and
they have to be a-d, then go in and make a custom field type that does
the check.. Then tell your designers to just say "type =>
'mySpecialField'" when they need to use it.

Or even better, develop entire classes of grouped widgets and their
validations, then get them to just incorporate those.
(Eg. an "Address" role, which brings in street, suburb, borough,
state, postcode, zip code, whatever.. and does all the validation..
You'll reuse that one a lot!)

> Actually, I guess that is possible to create them using Moose with H::FF although I am not sure.
> Ideally, the web designers that don't know Perl at all should be able to change the design of the forms at least.

Agreed, and this is where neither FormFu or FormHandler succeeds.

FormFu's yaml syntax ends up being horribly complicated, and
FormHandler's Perl code is not much clearer.

More information about the Catalyst mailing list