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

Peter Edwards peter at dragonstaff.com
Mon Sep 25 11:01:55 CEST 2006

The sort of interface I'd like would be a form definition file, say in
Config::General format, following a standard syntax.
As a starting point it would be worth looking at a Visual Basic .frm file to
see the sort of info that stores.
- general form level attributes, including data source spec
- nested containers, both simple and tabbed
- labels
- widgets for display elements with optional link to data source element
- back in InstantCRUD an overrideable handler for generalised form handling
tasks (list paging, record view, record next/prev, that sort of thing) and
backends for AJAX widgets.

Later on someone could write an Eclipse plugin to make it easy to set up
forms. Valuable for proof of concept prototyping and then you can fine tune
the form def or write custom TT2 templates where necessary.
It also makes it easy to write a utility to allow users to customise screen

Regards, Peter

-----Original Message-----
From: html-widget-bounces at lists.rawmode.org
[mailto:html-widget-bounces at lists.rawmode.org] On Behalf Of John
Sent: 24 September 2006 23:38
To: html-widget at lists.rawmode.org
Subject: Re: [Html-widget] Rails-like form helpers - RFC for a new module

--- Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:

> 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:
> $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.
> $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?

I personally like the idea of having a config file for
this.  One of the things that has really worked for me
with Formbuilding is that option to use a yaml
configuration file to build forms.  I didn't
personally like building the forms in the controller,
it really seems like a view thing to me, and
forwarding to a view to build the form and then to
Template Toolkit seemed really like a lot of extra

With formbuilding I can put the config file in with
the *.tt files and it seems really neat and ordered to

Other things I'd like is an easier way to have the
forms and other elements hook back to catalyst
controllers.  I've really liked the JSF idea of having
the template language be more than a renderer.  Makes
developing AJAX stuff easier.

So it would be very cool if instead of exposing
information to the template system you would expose
objects with callbacks to controllers.  However to get
this to work right we really need a better subrequest
system.  I've been playing with the subrequest plugin
from Trunk just to get the idea of how this all works
but haven't made so much progress in understanding it
all :)

Right now for my portal like system I'm just creating
objects that do dumb LWP requests to a controller.  It
works but feels very crude.


More information about the Html-widget mailing list