Skip to main content
robertr16769439
Participant
Mar 15, 2016 5:54 PM UTC
Answered

basic problem with UDF

I'm very frustrated calling a UDF, not getting the correct results

Here's the function, placed in a template named "basic_function.cfm"

<cffunction name="test" access="public" output="yes" returnType="string">

<cfreturn "Hello World">

</cffunction>

<cfoutput>#test#</cfoutput>

The output I get: cfbasic_function2ecfm687063398$funcTEST@70c49b0c

How can I get the string "Hello World"?

This topic is closed to new replies. Start a new post to keep the conversation going.
Dave Ferguson
Dave FergusonCorrect answer
Participating Frequently
Mar 15, 2016 6:54 PM UTC

You are currently just try to output whatever "test" is.  Since test is a function you would get what you are seeing.  Since you actually want to execute the function you need to call it as a function.

<cfoutput>#test()#</cfoutput>

HTH,

--Dave

2 replies

Dave Ferguson
Dave FergusonCorrect answer
Participating Frequently
Mar 15, 2016 6:54 PM UTC

You are currently just try to output whatever "test" is.  Since test is a function you would get what you are seeing.  Since you actually want to execute the function you need to call it as a function.

<cfoutput>#test()#</cfoutput>

HTH,

--Dave

Translate
robertr16769439
Participant
Mar 15, 2016 7:17 PM UTC

That does it!

Thanks, Dave.

Translate