Highlighted

basic problem with UDF

New Here ,
Mar 15, 2016

Copy link to clipboard

Copied

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"?

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

TOPICS
Getting started

Views

323

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

basic problem with UDF

New Here ,
Mar 15, 2016

Copy link to clipboard

Copied

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"?

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

TOPICS
Getting started

Views

324

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 15, 2016 0
Engaged ,
Mar 15, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 15, 2016 0
New Here ,
Mar 15, 2016

Copy link to clipboard

Copied

That does it!

Thanks, Dave.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 15, 2016 0