[Catalyst] Rails-like form helpers - RFC for a new module

Zbigniew Lukasiak zzbbyy at gmail.com
Sun Sep 24 20:41:30 CEST 2006


Dear all,

In the new InstantCRUD I decided to take out the code for html forms
generation and make a separate module for it.  After reading 'Rails-like
form helpers' thread I think that this module might find a more general use.
I would like to ask you what intefrace would you propose for it.

It can build the HTML::Widgets based on some config and data from the
database and then can also save the data from the widget to the database.
The config part is more complicated than it could be because the info about
many-to-many relations is not available from the schema so you need to
specify it in the config.  Since it is already there I've added also the
stringification to it - as it is a bit cleaner to have it here in the
interface part than overload stringification in the database schema
definition.

The current interface is composed of just two functions:

Catalyst::Example::InstantCRUD::Widget->make_widget($interface_config,
$class, $schema, $item);

$interface_config is a hash containing info about all db classes and how to
wigetify them, $class is the db class, $schema is DBIC schema and $item is
the db row to populate values in the form - its optional.

Catalyst::Example::InstantCRUD::Widget->populate_db($result, $item);

$result is HTML::Widget::Result and $item is the db row to be updated

So my question is do you think it deserves to be taken out from InstantCRUD
and then what name would you propose for it?  How would you design the API?

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060924/e2bed29a/attachment.htm 


More information about the Catalyst mailing list