>
>Even if you're handling validation in a separate object for instance,
>talking the "It's not the business object's responsiblity to 
>handle wrongly
>typed data", the above scenario would still play out in the 
>same way, one
>error at a time. Hence, it still seems "irresponsible" to me, and users
>would immediately pick it up.

I wouldn't implement it like that.

I'd have a validator object that takes a struct as arguments and knows what
the requirements are for each of the structure keys to be valid.

The validator object can then test each structure key in turn and create an
structure containing any errors.

The validator object's validate() method would return true or false
indicating success or failure. It would also have a getValidationErrors()
method that returned the structure that was populated by the validate()
method.

You always pass 2 objects to your form page a 'bean' object that contains
object data for edit operations and default values for create operations;
and a validator object on which you can call the getErrors() method.

Once you've got the error struct you can decide how to present the
information to the user.

Spike

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org 


 

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to