Link to home
Start Free TrialLog in
Avatar of msfletch
msfletchFlag for United States of America

asked on

Context validation error for the cffunction tag

I am getting an error within my CFC stating that I am missing an end tag. I can see the end tag there just fine. I have isolated the function into its own cfc and the problem persists. A code snippet is attached.

I am getting the argument trying access the page as a WSDL. I have discovered that if I remove the <CFARGUMENT> line then it comes back fine.

Hopefully I am just missing something stupid. Thanks for any help!

<!--- begin component code --->
<cfcomponent>
 
<!--- check for validly formatted exp date --->
<cffunction name="validExpDate" access="remote" returnType="string">
 
	<!--- set default values --->
	<cfset isValid = 1>
 
	<!--- required argument --->
	<cfargument name="expDate" type="String" required="No">
	
	<cfset expDate = "12/08">
	
	<!--- remove non-numerical values --->
	<cfset checkDate = #TRIM(ReplaceNoCase(arguments.expDate, "/", "", "ALL"))#> 
	
	<!--- check if four characters --->
	<cfif LEN(checkDate) IS 4>
		<!--- parse data into a date --->
		<cfset checkDate = #CreateDate("20#RIGHT(checkDate, 2)#", "#LEFT(checkDate, 2)#", 01)#>	
	<!--- check if 6 characters --->
	<cfelseif LEN(checkDate) IS 6>
		<!--- parse data into a date --->
		<cfset checkDate = #CreateDate("20#RIGHT(checkDate, 2)#", "#LEFT(checkDate, 2)#", "#MID(checkDate, 3, 2)#")#>	
	<!--- not 4 or 6 characters --->		
	<cfelse>
		<cfset isValid = 0>
	<!--- end character length check --->
	</cfif> 
	
	<!--- check if there is something to validate --->
	<cfif (isValid) IS NOT 0>
		<!--- check if date valid --->
		<cfif IsValid("Date", checkDate)>
			<!--- add a month to the date --->
			<cfset checkDate = #DateAdd("m", 1, checkDate)#>
			<!--- check if new date is in the past --->
			<cfif (checkDate) LT #now()#>
				<cfset isValid = 2><!--- indicates expired card --->
			</cfif>
		<!--- date is not valid --->
		<cfelse>
			<cfset isValid = 0>
		</cfif> 
	<!--- end validation check --->
	</cfif> 
	
	<!--- return result --->
	<cfreturn isValid>
	
</cffunction>
 
</cfcomponent>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msfletch

ASKER

Thanks SidFishes! I was just in the process of trying that when I saw your message. Correct and quick as always.