Search code examples
coldfusioncoldfusion-8

How to use cfparam for a structure in CF8?


I need to pass a structure to a method, but it will not always be defined.

Is there something like this that would work?

<cfparam name="system_message" default={}>

When I try this I get, the argument passed to the function is not of type struct.

Also, I realize, I could do this:

<cfif ! isdefined("system_message")>
      <cfset system_message = {}>
</cfif>

But I was just wondering if there was a shorter way of doing it, using cfparam.

Thanks for any help!


Solution

  • What about:

    <cfparam name="system_message" default="#StructNew()#">
    

    CF8 doesn't like the curly braces version.