On Wed, 27 Jul 2005, Alex Aminoff wrote:

> However, I cannot seem to find what I want, which is an automatic HTML form
> generator (and something that subsequently does updates based on the
> CGI->param's passed back) that lets you edit all the rows of a table (or a
> slice of a table) at the same time.

Ah. I didn't get that from your first post, sorry.

>                                      Maypole, for example, whose
> documentation on this seems the clearest, has a "list" method that produces
> a list of records, but to edit each record you have to hit an edit button
> which takes you to a different screen. This is not what I want. I want all
> or some of the fields in the list to be editable widgets. Since there is no
> hierarchical structure to $CGI->param's, this means that the module would
> have to encode the primary key of the row into the name of the parameter so
> you know which row to update, and the update function would have to know how
> to decode that.

Maypole is not fixed. You could easily add that functionality. It would be
quite trivial to adapt the "list" template to render form elements instead
of a list. The handler for the submission would do something like:

1. Determine the record ids by examining the parameters returned.
2. Compose a hash for each record using the database column names as keys.
3. Call updatefromcgi on each record, capturing any error messages.
4. Display a results template.

> I'm not finding any module that seems to do this.

Maypole can definitely do this, as can CGI::Application and Catalyst if
you want them to. I think the lack of pre-rolled modules for this is that
it's very rare that you would actually want to do it. Having said that,
perhaps CGI::Expand might get you some of the way ?

http://search.cpan.org/~bowmanbs/CGI-Expand-1.02/Expand.pm

>                                                   I can sort of understand
> why: once you start thinking in terms of Class::DBI, each row is an object,
> so it's very natural to want to do things to only one object at a time.
> OTOH, if you find HTML::Template's <TMPL_LOOP> concept intuitive, then you
> can immediately see why you would want what I want.

You're comparing the model with the view (in an MVC framework sense). I'm
sure I get what you mean ?

Simon.

-- 
"Ah, this is obviously some strange usage of the word 'safe' I wasn't
 previously aware of."

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to