Hi all,
I am using a function to check two dates to make sure that an end date comes after a start date. Right now I am trying to call it like this
and my function is
the cfoutput is showing the correct true/false values being produced by the function but the cfif statement isn't executing when date_check is false. Am I using the boolean evaluator incorrectly? Also, is there a way to put the function call into the IsDefined function? I tried IsDefined("chec k_date(#Form.st artDate#,#Form. endDate#)") but that gave me an error.
Thanks.
I am using a function to check two dates to make sure that an end date comes after a start date. Right now I am trying to call it like this
Code:
<cfset date_check=check_date(#Form.startDate#,#Form.endDate#)>
<cfoutput>#date_check#</cfoutput>
<cfif NOT isDefined("date_check")>
<li>Please make sure the end date comes after the start date.</li>
</cfif>
Code:
<cffunction
name="check_date"
return type="boolean">
<cfargument
name="start_date"
type="date"
required="yes">
<cfargument
name="end_date"
type="date"
required="yes">
<cfif start_date lt end_date>
<cfset return_value=true>
<cfelse>
<cfset return_value=false>
</cfif>
<cfreturn return_value>
</cffunction>
Thanks.
Comment