Well now, that reminds me of a funny story.  I remember like it was
yesterday ...

I had to code a survey with over 500 fields, with information being
collected over 6 or so pages.  Usually, I would just store the required
field names in a hash, and loop through the hash and validate.  In this
case, I made a new table in the database, called form_fields.  I put a
row in the table for each form field, along with the type of data, the
page/runmode it was gathered by, a description (handy for error
messages), the table into which it was to be inserted, and whether it
was required.  Then for each page, I just called my function
&validate($self), which selected all the rows matching the current
runmode, and validated the data accordingly.

There's probably a smarter way to do it, using the data dictionary or
something, but it did the trick for me, and it's database-independent.

HTH.

-----Original Message-----
From: John Lawton [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 01, 2002 1:28 PM
To: [EMAIL PROTECTED]
Subject: [cgiapp] Form validation


While this may be peripheral to CGI::Application, I'd like to get some 
feedback on what others are using for form validation. I am particularly

interested in documented (tested) packages, as opposed to homegrown, ad 
hoc solutions. (With all due respect to the hackers out there)

I have taken a look at Data::FormValidator. This module makes it 
possible to describe the required/optional parameters, dependencies, 
filters, and constraints in a separate file (metafile).  I like the 
approach this module takes, from my experience as a programmer, it seems

like this module is comprehensive. However, I am still wondering if 
CGI::Application people are using any other interesting modules for this

purpose?

-john

PS I have also taken a cursory look at Params::Validate, it appears to 
be designed to solve a slightly different problem, parameter validation 
when passing parameters into methods.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to