This is how I would re-write this. Please note that I removed cfform
and cfinput
form example. They are not needed, and will likely cause issues down the road. You should pass in, as arguments, any data your function is going to need.
<cffunction name="test" returntype="string" output="false">
<cfargument name="name" type="string" required="true" />
<cfreturn "So, your name is #arguments.name#?" />
</cffunction>
<cfif isDefined("form.name") >
<cfoutput>#test( htmlEditFormat( form.name ) )#</cfoutput><br>
</cfif>
<form method="post">
<input name="name" type="text">
<input name="TEST" type="submit" value="Call test()">
</form>