[html-formfu] RFC: Catalyst::Model::FormFu
daisuke at endeworks.jp
Thu May 10 23:51:24 GMT 2007
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
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
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?
More information about the HTML-FormFu