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

Daisuke Maki daisuke at endeworks.jp
Tue May 22 05:42:16 GMT 2007


I whipped something up.

   http://svn.endeworks.jp/svn/Catalyst-Mode-FormFu/trunk

Anybody care for a test drive?

--d

Brian Kirkbride さんは書きました:
> 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.
> 
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
> 




More information about the HTML-FormFu mailing list