Peter Hardy wrote:

> Hi guys,
>  
> I've seen this on the forum before but I'm can't remember the answer
> at all.
>  
> I've created a transfer object that takes amongst others a couple of
> date parameters. Trouble is, they are optional parameters so sometimes
> they are a valid date and sometimes they are equal to "".
> If my cfargument type to date cf just throws an exception.
>  
> How do I handle this? Shoudl I just store it as a string?
>  
> Cheers, Pete (aka lad4bear)

Bill Rawlingson modified an older version of Rooibos Generator to
quasi-accomodate date types.  It's in the new version of Rooibos (see
signature) - just use the date type in the bean template.

    <cffunction name="setDate_created" access="public" returntype="void"
output="false">
        <cfargument name="date_created" type="string" required="true" />
        <cfif isDate(arguments.date_created)>
            <cfset arguments.date_created =
dateformat(arguments.date_created,"YYYY/MM/DD") />
        </cfif>
        <cfset variables.instance.date_created =
trim(arguments.date_created) />
    </cffunction>
    <cffunction name="getDate_created" access="public"
returntype="string" output="false">
        <cfreturn variables.instance.date_created />
    </cffunction>

Best,
.Peter

-- 
Peter J. Farrell :: Maestro Publishing
http://blog.maestropublishing.com

Rooibos Generator - New Version! - Version 2.1
Create boilerplate beans and transfer objects for ColdFusion!
http://rooibos.maestropublishing.com/

Member Team Mach-II - It's coming...



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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


Reply via email to