Re: Better handling of constraint failures?

[prev] [thread] [next] [Date index for 2004/08/12]

From: Drew Taylor
Subject: Re: Better handling of constraint failures?
Date: 17:27 on 12 Aug 2004
dan@xxxxxxxxxxxx.xxx wrote:
 >
> The reason I want to catch constraint failures is because I want the
> constraint checking to act as my HTML form validation check: If the
> constraint check barfs, I want to re-output the form with an error
> message on the field that failed. Without an easy way to know which
> field failed, this won't be easy. Using CDBI constraints to check
> form values seems like a pretty good way to not repeat myself. . .
> but I need to give the user specific feedback about the failure.

Hmmm, here's some food for thought. I'm currently using 
Data::FormValidator for my param checking. It works great and I've got 
it integrated into my application base class so I get it pretty much for 
free.

But I also have constraints for some columns in a few CDBI classes. So 
now I have constraints in 2 places: my D::FV profiles and my CDBI class. 
It would be nice if there were a way to "export" the constraints with my 
CDBI classes so that I can easily integrate that with D::FV. Something like:

my $cdbi_cons = Class->export_constraints;
my $dfv_profiles = {runmode1=>{required=>['foo'],
                                constraints=>$cdbi_cons,
                               }};
# do actual D::FV validation here

The idea here is that it's MUCH easier for me to have the D::FV failures 
integrated with my forms than CDBI constraints. I already have glue code 
setup so that all failures are caught and properly displayed to the 
user. Thoughts? Did I explain myself properly?

Drew
        -- 
        ----------------------------------------------------------------
Drew Taylor                 *  Web development & consulting
Email: drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
----------------------------------------------------------------

Re: Better handling of constraint failures?
Drew Taylor 17:27 on 12 Aug 2004

Re: Better handling of constraint failures?
Clayton L. Scott 19:29 on 12 Aug 2004

Re: Better handling of constraint failures?
Drew Taylor 19:54 on 12 Aug 2004

Re: Better handling of constraint failures?
Clayton L. Scott 19:53 on 12 Aug 2004

Re: Better handling of constraint failures?
Clayton L. Scott 20:01 on 12 Aug 2004

Re: Better handling of constraint failures?
Perrin Harkins 19:51 on 12 Aug 2004

Re: Better handling of constraint failures?
Daniel Collis Puro 20:01 on 12 Aug 2004

Re: Better handling of constraint failures?
Clayton L. Scott 20:04 on 12 Aug 2004

Re: Better handling of constraint failures?
Daniel Collis Puro 20:42 on 12 Aug 2004

Re: Better handling of constraint failures?
Clayton Scott 21:49 on 12 Aug 2004

Re: Better handling of constraint failures?
Tony Bowden 13:52 on 24 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52