Questions tagged [cffunction]

is used in ColdFusion Markup Language (CFML) to create user defined functions.

<cffunction> is used in ColdFusion Markup Language to create user defined functions. The basic syntax is

<cffunction name="myFunc" returntype="string" output="false">

  <cfreturn "Hello, World!">
</cffunction>

Functions may be created as a global function or as apart of an object (cfc). Functions typically include business logic and not presentation logic.

Functions can also be defined in <cfscript> via

string function myFunc() output="false" {
   return "Hello, World!";
}

Resources

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-f/cffunction.html

37 questions
1
vote
2 answers

How to use a ColdFusion Component to re-use code?

I'm trying to put together a footer in ColdFusion using a component. I want to be able to re-use the footer throughout my application, but only have to write the footer HTML once. Here's what I have so far, but I'm unable to output the…
Millhorn
  • 2,953
  • 7
  • 39
  • 77
1
vote
2 answers

trying to get the data like this from the cfc function

I have a cfc where i need t return the headers for the jqgrid for binding dynamically i am trying to query the data like this: colNames: ['ID', 'Institution Name', 'Display Name', 'Short Name', 'Board of Education', 'Scheme Name','Subscription…
Seb
  • 49
  • 6
1
vote
1 answer

Setting access to remote in a cffunction includes the application.cfm page

When I set a cffunction's access to remote--so I can call it through AJAX--the call returns the HTML I have in my Application.cfm template. Is there any way around this, or do I have to move the HTML out of Application.cfm?
Timothy Ruhle
  • 7,387
  • 10
  • 41
  • 67
1
vote
1 answer

ColdFusion10 restAPI returning malformed JSON because of special characters

I have created a CFFunction that returns JSON from a query, but it is not returning special characters correctly. I have checked the record in the database and it is saving correctly in the database so I know the problem is with the API. Below is…
Anthony Doherty
  • 111
  • 1
  • 11
1
vote
1 answer

How To Call A Void ColdFusion Function With No Arguments

I'm writing a ColdFusion function that is the following:
T. Tenner
  • 121
  • 9
1
vote
1 answer

Server side validation ColdFusion 9?

I have one question about my server side validation. I'm passing the arguments in my cffunction. Some of these arguments are FROM values populated by the user and some of them are hidden values that I have populated from data base. Hidden values…
1
vote
0 answers

Calling a JavaScript function within a loop

I have some geofence script that I am using on a cfm page: function getDistance(loclat, loclon, fencelat, fencelon, units = 'kilometers') { // earth's radius. Default is miles. var radius = 3959; if (arguments.units EQ…
user3939487
1
vote
2 answers

How to get return variable from coldfusion cfc page?

I have function that makes call to .cfc pag. I'm passing method and parameter along with the page name. Here is my code: function callFunction(name){ param = name; location.href = 'myTest.cfc?method=getRecords&userName=' + param; } Here is…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
1
vote
1 answer

using a query as an argument to a cffunction

I would like to pass a query as a parameter to a function. According to the docs You can specify query as an argument type. However, when I try doing this: SELECT…
Luke
  • 5,567
  • 4
  • 37
  • 66
1
vote
2 answers

put argument's struct in variables scope

I want to easily put an argument's struct contents into the variables scope for all functions of a component. 'Title' is one of the searchitems struct.
Beth B
  • 59
  • 2
1
vote
2 answers

How to call a cf-function only once and on a user trigger in Coldfusion?

I have a component in Coldfusion8, that constructs a log of error messages and passes it to a variable in JSON to be picked up by Jquery. I'm rebuilding this component when the user changes languages (reloads the page) like so: HTML:
frequent
  • 27,643
  • 59
  • 181
  • 333
0
votes
2 answers

Function Gets Timeout Error. Is There A More Efficient Way To Rewrite This Function?

This CF Function is getting a timeout error. It's executed in a page that has more stuff going on. Is there a more efficient way to rewrite this function?
FSUKXAZ
  • 95
  • 7
0
votes
6 answers

How to call a ColdFusion function from a .cfc file?

I have a .cfc file with all my functions in it (wrapped in a tag), including this one:
Millhorn
  • 2,953
  • 7
  • 39
  • 77
0
votes
3 answers

Best practice to explicitly scope a cffunction defined in cfm

I understand that in ColdFusion, explicit scoping is a Good Thing. Since learning this, I try to explicitly scope all variables, even for variables like queries, for example, or . My…
krubo
  • 5,969
  • 4
  • 37
  • 46
0
votes
1 answer

Coldfusion set time out in .cfc page?

I have one .cfc that I use for all communication between client and server code. This cfc page has about 10 different function. Each function has different purpose and I have queries for Select, Insert, Update and Delete. I'm wondering if I should…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193