[html-formfu] RFC: Catalyst::Model::FormFu

Brian Kirkbride brian.kirkbride at deeperbydesign.com
Fri May 11 00:27:42 GMT 2007

Daisuke Maki wrote:
> Hi,
> I've been using FormFu on my Catalyst projects, but instead of using
> Catalyst::Controller::HTML::FormFu, I've implemented a model class and
> was wondering if people are interested in seeing it as
> Catalyst::Model::FormFu
>  sub foo : Local
>  {
>     my ($self, $c) = @_;
>     my $form = $c->model('FormFu')->load_form('path/to/file.yml');
>     ...
>  }
> I've also implemented form caching and dynamic value insertion using
> Data::Visitor. For caching, each form is cached after creation so the
> same form doesn't need to be created more than once (this has proven to
> be a very large performance booster for me).
> Dynamic values are, for example, those select lists whose values you
> want to pull from the database. I've implemented this by allowing this
> kind of construct in your config file:
>   - type: select
>     options: __dynamic(get_data_from_database)__
> The value __dynamic(get_data_from_database)__ is replaced by the result
> of calling $model->get_data_from_database.
> This particular code is still integrated very tightly with my app, but
> I'm thinking if I refactor it as Catalyst::Model::FormFu, it might be a
> good addition to the formfu toolkit.
> What do you think?
> --d

This looks very promising!  I was thinking along these lines already, as the
Form fits very nicely in the Model part of most apps.

More information about the HTML-FormFu mailing list