On 01/08/07, Scott Stroz <[EMAIL PROTECTED]> wrote:
>
>
> Blair,
>
> That is exactly what I am looking for Thanx!
>
> Some more questions if you don't mind.
>
> 1. On one content type, we may need to do some manipulation of data
> before being saved, where in your example would I include that logic?
>
> 2. On several content types, we will need to execute some external
> code after being saved, where in your example would I include that
> logic?
>
> I assume I can put this logic inside <ft:ProcessForm /> but not sure
> where.
>
farcry.core.types.types has methods for pre and post processing.
They are the aptly named beforeSave and afterSave methods. You can override
them in your own custom type to do what you need them to so.
I've only ever used the beforeSave, which is automagically called when you
do a set or create Data, but afterSave should be the same.
Here's a basic beforeSave method for you. (Thanks to Mat for sending me this
orginally)
<cffunction name="BeforeSave" access="public" output="false"
returntype="struct">
<cfargument name="stProperties" required="true" type="struct">
<cfargument name="stFields" required="true" type="struct">
<cfargument name="stFormPost" required="false" type="struct">
<!--- This calls the basic beforeSave in types.cfc (sets label and
datetimelastupdated fields) --->
<cfset arguments.stProperties =
super.beforeSave(stProperties="#arguments.stProperties#",
stFields="#arguments.stFields#", stFormPost="#stFormPost.stFormPost#")>
<!--- Do your stuff here to update arguments.stProperties --->
<cfreturn arguments.stProperties>
</cffunction>
Hope that helps
Regards
Stephen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---