[html-formfu] Best approach for multiple item editing

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Tue Sep 30 13:07:56 BST 2008


Hi,

I am currently refactoring an older Catalyst app, and in the process
changing it from using HTML::Widget to HTML::FormFu.

The parts of this that are relatively straight CRUD operations are nice
and easy to do. However I'd like to get suggestions as to the best way
of handling some of the less straightforward items.

The Model for the app is a DBIx::Class stack.

Generically, what I want to do is be able to add a mechanism for editing
a whole batch of items on one form - the items are the result of a
has_many relationship.

Specifically I have an Event table (this contains data for name etc, as
well as a start_date and end_date - the dates here are pure date (no
time) fields inflated into DateTime).

An Event has_many Bookings - these have a start_time and an end_time,
which are also inflated into a DateTime although these do have time
elements on them. [There is an unexpressed constraint on a Booking that
the start_time and end_time must be on the same calendar day].

I want to be able to have a Bookings edit form for an Event - giving me
the chance to edit all the Bookings for a particular event (including
adding/deleteing bookings).

When trying this with HTML::Widget I had some horrid code in the
Controller which generated up a form with a set of lines (one per
Booking) with:-

   -- Date pulldown - range limited by Event Date (plus blank/ 
unselected)
   -- Start time pulldown, 30 minute intervals across the day
   -- End time pulldown, 30 minute intervals across the day

For the case when first editing the Bookings for an Event the Model
would generate a standard set of Bookings to bootstrap this. There were
also a couple of additional sets of Booking lines over those currently
used to allow additional bookings to be added.

Given this sort of arrangement, how would you suggest I approach making
a form to edit Bookings for an Event?

[Some of this would better suit an AJAXy edit form I know, but I would
like to have a basic HTML version before adding whizzy stuff. And if you
are wondering what all this is for, its the bookings management stuff
for a community theatre.]

Cheers
     Nigel.

--
[ Nigel Metheringham             Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]




More information about the HTML-FormFu mailing list