[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] repeating form fields


This is kinda OT, but it impacts presentation/code, plus it's a real
pain for my CGI::App material at the moment, and affects the BREAD
concept.

I posted the problem to PerlMonks:
http://www.perlmonks.com/index.pl?node_id=232899

but haven't had any success yet.

Basically I want to display for entry/edit multiple sets of data in the
same form.  This occurs when my users want to enter/edit a large number
of small pieces of data, and having each set in it's own form would be
very tedious.

The problem is how to have the repeating fields so that they play well
with designers, Data::FormValidator, and HTML::FillInForm.  

The designer-friendly way is to have the fields with the same names:

<input name="title">
<input name="author">
<hr>
<input name="title">
<input name="author">
..etc

We can place this in a loop to repeat N times, and it works great.
(Note that N might change, for example, I might want to display 6
entries for new entry, but min(6, #existing+2) to edit existing
entries.)

This, however, doesn't play well with Data::FormValidator or
HTML::FillInForm.  D::FV can't tell the "subforms" apart, so it only
reports on the page, and H::FIF will repeat any answers to fill in
multiple blocks.  [The exact problems differ depending on the type of
form field used...SELECT boxes show different symptoms than input boxes]

D::FV can be corrected by breaking the input into sets.

H::FIF really only works if the fields have unique names.  This can be
done by appending a "number" to the fieldnames, but then the HTML
becomes much less designer friendly.  (I'm using Template Toolkit, but
this holds for most any template system I can think of).

Has anyone else dealt with this?

-- 
SwiftOne
suppressed

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.