Hi Brian, Mark

 

If a form field contains invalid data that cannot be set on a bean due to a
type failure, how would you handle redisplaying that original invalid data
back on the form again?

 

Thanks

 

Kevan

 

  _____  

From: cfcdev@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of
Brian Kotek
Sent: Thursday, 25 September 2008 2:23 AM
To: cfcdev@googlegroups.com
Subject: [CFCDEV] Re: Using object "getters" after form validation fails

 

I have a Validator that first attempts to set the properties on the bean (I
use a Transfer object that has been cloned so that the updates don't affect
the real object until it is saved, but this could be done manually as well).
If any properties fail to be set (argument type failure), I record those as
validation errors and then move on. After the properties are set I run a
validation on them to ensure that they conform to my rules (unique value,
between two numbers, required, greater than/less than, etc.) and capture
those as well. Only if the validator has no errors at this point do I save
the object. So you don't have to type your arguments to any, you can just
capture setter failures and treat them like any other validation failure.

 

On Wed, Sep 24, 2008 at 9:11 AM, Kevan Stannard <[EMAIL PROTECTED]>
wrote:


Validation discussions frequently bring up the concept of populating beans
with potentially invalid data then calling a bean.validate() function, but
something doesn't quite feel right about it for me.

If I have a date field in my bean, then I would like it to be a real date
value (or an empty string meaning null), or if I have a numeric field in my
bean then I want it to be a real numeric value. Allowing them to be anything
entered by a user just doesn't feel right - but that is just where my head
is at right now.

 




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to cfcdev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to