[Catalyst] Form validation in insert() and update()?
Bill Moseley
moseley at hank.org
Tue May 15 05:15:56 GMT 2007
On Mon, May 14, 2007 at 07:42:00PM -0700, mla wrote:
> >Which is why I like the "form" validation tools to not be specific to
> >the web/HTML side of things. The HTML side of the forms are easy, anyway,
> >and often require hand-customizing. That way the same "forms" can be
> >used for more than just the web environment.
>
> So you're saying you place as many constraints on the actual db tables
> as possible (e.g., NOT NULL, check constraints, unique indexes, etc).
>
> But then you rely on the form data validation to catch all the normal
> user-supplied form errors, right?
Yes, I define form modules that validate the field types and do any
other context based validation and cross field validation. So when
the form validates the data should go into the database without any
complaints.
> You don't rely on the db to actually raise exceptions and propagate
> those errors back to the user in some way, right? A db exception would
> indicate that the form validation missed something and you'd just croak
> in that case. Is that right?
Right. The database throwing an exception is, well an exception
that is not expected and I log the message and send the user a 500 and
a message that they have been a very, very bad user.
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list