[html-formfu] Re: Consistent approach to forms for single/multiple items?

Mario Minati mario.minati at googlemail.com
Thu Oct 4 08:02:48 GMT 2007


On Wednesday 03 October 2007 23:25:06 Will Hawes wrote:
> On 03/10/2007, Mario Minati <mario.minati at googlemail.com> wrote:
> > On Wednesday 03 October 2007 17:46:46 Will Hawes wrote:
> > > On 21/08/2007, Will Hawes <wdhawes at gmail.com> wrote:
> > > > Most forms deal with a single "thing" at once - editing a single
> >
> > database
> >
> > > > row, sending an email message, etc.
> > > >
> > > > But what about forms that deal with multiple "things" at once? As an
> > > > example, a tabular display of products with a text field next to
> > > > each, allowing the user to enter an arbitrary quantity of each
> > > > product to
> >
> > add
> >
> > > > to a shopping basket and use a single button to submit the quantities
> >
> > for
> >
> > > > all products at once.
> > > >
> > > > Product | Quantity
> > > > -------------------------------
> > > > Foo       |  { text field 1 }
> > > > -------------------------------
> > > > Bar       |  { text field 2 }
> > > > -------------------------------
> > > >
> > > > Would you use the ->render method, meaning form elements have to be
> > > > created for the "Product" column of each row when all it needs to
> >
> > display
> >
> > > > is a simple text value? Or would it be better to use a template to
> >
> > render
> >
> > > > the form, having generated something like this beforehand:
> > > >
> > > > [
> > > >   { product => 'Foo', quantity => \$text_field_1 },
> > > >   { product => 'Bar', quantity => \$text_field_2 },
> > > >   ...
> > > > ]
> > > >
> > > > Either way seems feasible and probably there are other ways I've not
> > > > thought of. In any case it would be nice to generate both "types" of
> >
> > form
> >
> > > > in a single consistent way. How do others do this?
> > >
> > > *bump*
> > >
> > > Anyone? Even if you don't understand the question due to poor
> >
> > explanation
> >
> > > on my part. The above is too common a scenario for no-one on this list
> >
> > to
> >
> > > have implemented something similar.
> >
> > There is a SimpleTable element that helps creating tables.
>
> Thanks, I'd not seen that before, but it does look as though it could be
> useful.
>
> If you are looking for real multiple elments support e.g. if you want to
>
> > allow
> > to input an unknown number of addresses in the same form, this something
> > we
> > are still working on.
>
> Is this in SVN already? I'd be interested to look at the source.

Carl put already some work in this and in the Dojo section of the svn tree 
there is a Multiple controller.

For good support of this feature I am currently working on nested parameters 
which is a base for the multiple stuff.

Greets,
Mario



More information about the HTML-FormFu mailing list