After hearing and reading alot recently about declaring local variables in my functions I decided to go ahead and re-examine my CFC's and declare local variables where necessary. Take the following cffunction block for example:

<cffunction name="getBadDebt" displayname="Check For Bad Debt" returntype="string">
    <cfset var qBadDebt = "" />
<cfargument name="SSN" type="numeric" required="true" default="0" />
<cfquery name="qBadDebt" datasource="#variables.DSN#" username="#variables.UN#" password="#variables.PW#">
  SELECT collections.bad_debt_check(null,#arguments.SSN#) as badDebtReturn
  FROM DUAL
</cfquery>
<cfreturn qBadDebt.badDebtReturn />
  </cffunction>

This function worked just fine before I declared the local variable "qBadDebt" and now when I instantiate the cfc with createObject() I get the following error:

Context validation error for tag cffunction.  
The start tag must have a matching end tag. An explicit end tag can be provided by adding </cffunction>. If the body of the tag is empty you can use the shortcut <cffunction .../>.  

If I remove the local variable declaration it works just fine.

Any ideas?

Thanks,

Nate
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to