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

Re: [cgiapp] repeating form fields


Quoting Brett Sanger <suppressed>:

> > The only way I can see to solve this with any consistency is to use
> numbered
> > variable names.  With HTML::Template you could use something like this:
> 
> Which was the solution I mentioned in my previous post...the solution
> that leaves a nasty template and a fair amount of hacking with D::FV.  

What hacking is required with Data::FormValidator.  You can specify a regexp to
define your form fields.

>From the D::FV perldocs (spelling mistakes and all):
 required_regexp
            This is a regular expression used to specify
            additional fieds which are required. For example, if
            you wanted all fields names that begin with user_ to
            be required, you could use the regular expression,
            /^user_/

in your case you could supply /^title\d+$/ and /^author\d+$/

And if you want to do constraint checking.

>From the D::FV perldocs:
constraint_regexp_map
            This is a hash reference where the keys are the
            regular expressions to use and the values are the
            constraints to apply. Used to apply constraints to
            fields that match a regular expression.  For example,
            you could check to see that all fields that end in
            "_postcode" are valid Canadian postal codes by using
            the key '_postcode$' and the value "postcode".

Is this what you are looking for?  Or am I missing your original question
completely?

As for the ugly look of the template, I don't think it is that bad, but that is
a personal opinion.  I think you are going to be stuck with this thanks to the
limitation of HTML form submissions.  Unless you want to do some nasty
JavaScript hacks to submit your data in nice ordered chunks, but that just
sounds evil to me...

Cees

---------------------------------------------------------------------
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.