Difference between save() and valid() in terms of validation

28 views
Skip to first unread message

Mohamad El-Husseini

unread,
Sep 1, 2010, 1:24:10 PM9/1/10
to ColdFusion on Wheels
What's the difference between using valid() and save()?

If I read correctly, it's not possible to validate data unless you are
using the save() function, correct? So what's the use of the valid()?

This also means it's not possible to validate information before
committing it into the session scope correct?

raulriera

unread,
Sep 1, 2010, 1:26:34 PM9/1/10
to ColdFusion on Wheels
valid() will inspect the data to see if its valid and that's it,
save() will do it and save it to the database afterwards

Chris Peters

unread,
Sep 1, 2010, 2:06:00 PM9/1/10
to cfwh...@googlegroups.com
Raul's description below is correct. One thing worth noting is that to even have a model to run validations on, there must be an underlying database table for Wheels to introspect.

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.


Mohamad El-Husseini

unread,
Sep 1, 2010, 11:36:55 PM9/1/10
to ColdFusion on Wheels
Thanks for the explanation. Is it possible then to use the same
validation functions (validatesPresenceOf().... etc...) when using
valid(), or are those only available when saving to the model?

On Sep 1, 3:06 pm, Chris Peters <ch...@clearcrystalmedia.com> wrote:
> Raul's description below is correct. One thing worth noting is that to even
> have a model to run validations on, there must be an underlying database
> table for Wheels to introspect.
>
> On Wed, Sep 1, 2010 at 1:26 PM, raulriera <rierar...@gmail.com> wrote:
> > valid() will inspect the data to see if its valid and that's it,
> > save() will do it and save it to the database afterwards
>
> > On Sep 1, 7:24 pm, Mohamad El-Husseini <abitdo...@hotmail.com> wrote:
> > > What's the difference between using valid() and save()?
>
> > > If I read correctly, it's not possible to validate data unless you are
> > > using the save() function, correct? So what's the use of the valid()?
>
> > > This also means it's not possible to validate information before
> > > committing it into the session scope correct?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ColdFusion on Wheels" group.
> > To post to this group, send email to cfwh...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cfwheels+u...@googlegroups.com<cfwheels%2Bunsu...@googlegroups.com>
> > .

raulriera

unread,
Sep 1, 2010, 11:42:47 PM9/1/10
to ColdFusion on Wheels
Those are exactly what valid() validates (sorry about that) against
> > > cfwheels+u...@googlegroups.com<cfwheels%2Bunsubscribe@googlegroups.c­om>

Mohamad El-Husseini

unread,
Sep 2, 2010, 1:28:58 PM9/2/10
to ColdFusion on Wheels
Why sorry? That's awesome. That means I can use valid() to validate
data and store it in the session, then copy it to the tables when I'm
ready, no? That's awesome!
> > > > cfwheels+u...@googlegroups.com<cfwheels%2Bunsubscr...@googlegroups.c­om>
Reply all
Reply to author
Forward
0 new messages