Where is the validation failing? At a form level, or at the object level?

I will commonly have code that looks like:

obj.setFoo(value);
if(object.validate());
{
  save(obj);
}

return obj;

Then if the object doesn't validate, I can pass it back to my view,
and it can display the invalid data just as it would do normally.

That make sense?

Mark

On Wed, Sep 24, 2008 at 3:27 PM, Michael Sharman <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I'm after some suggestions for a quite common scenario. I have a site
> where users are registered (i.e. they have a profile) and have the
> option of updating their details after logging in.
>
> I load the "update" form's controls from a User.cfc
>
> e.g. <input type="text" name="email" id="email"
> value="#oUser.getEmail()#" />
>
> Now when the form gets submitted validation takes place and if that
> validation fails the update form is reloaded with an error message.
> The problem is that I want to display the new information that the
> user has entered even though it hasn't yet been updated in the
> database.
>
> I feel I can't update the User objects "state" if the validation fails
> as the user may navigate away from the update form and as the rest of
> the site depends on the User object's information this would be
> potentially incorrect.
>
> Would I be looking at some kind of memento pattern here? Some kind of
> a global #request.input# struct? How do people get around this,
> hopefully without complicating/messing up views with a cfparam for
> each User property etc
>
> Thanks
> >
>



-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com

--~--~---------~--~----~------------~-------~--~----~
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