cfc

How do I force a Coldfusion cfc to output numeric data over JSON as a string?

左心房为你撑大大i 提交于 2019-12-01 19:24:15
I'm calling a Coldfusion component (cfc) using jQuery.post(). I need an integer or string representation of the number returned for use in a URL. {"PAGE":"My Page Title","ID":19382} or {"PAGE":"My Page Title","ID":"19382"} Instead what I get back is a decimal: {"PAGE":"My Page Title","ID":19382.0} Needed to update the following HTML: <a href="page.cfm?id=19382" id="pagelink">My Page Title</a> Conceptually, I suppose there are multiple answers: 1) I could use jQuery to grab the number left of the decimal point. 2) I could force Coldfusion to send the number as a string. 3) I could generate the

coldfusion weird extra space

我的未来我决定 提交于 2019-12-01 17:12:52
I have a function to convert string to number <cffunction name="convertToNumber" returntype="numeric"> <cfargument name="separator" required="Yes" type="string" /> <cfargument name="number" required="Yes" type="string" /> <cfset LOCAL.arrSeparator = ["comma", "period", "lakh_crore"] /> <cfif ARGUMENTS.separator eq "comma" or ARGUMENTS.separator eq "lakh_crore"> <cfif ListLen(ARGUMENTS.number, ".") eq 2> <cfset LOCAL.integral = ListFirst(ARGUMENTS.number, ".") /> <cfset LOCAL.fractional = ListLast(ARGUMENTS.number, ".") /> <cfelse> <cfset LOCAL.integral = ARGUMENTS.number /> <cfset LOCAL

coldfusion weird extra space

那年仲夏 提交于 2019-12-01 16:00:43
问题 I have a function to convert string to number <cffunction name="convertToNumber" returntype="numeric"> <cfargument name="separator" required="Yes" type="string" /> <cfargument name="number" required="Yes" type="string" /> <cfset LOCAL.arrSeparator = ["comma", "period", "lakh_crore"] /> <cfif ARGUMENTS.separator eq "comma" or ARGUMENTS.separator eq "lakh_crore"> <cfif ListLen(ARGUMENTS.number, ".") eq 2> <cfset LOCAL.integral = ListFirst(ARGUMENTS.number, ".") /> <cfset LOCAL.fractional =

Can cfmodule return values to caller's local scope?

纵饮孤独 提交于 2019-11-30 21:03:19
Inside the cfm of the cfmodule, values are returned through the use of Caller scope. If I call a cfmodule inside a function in a CFC, Caller maps to the Variables scope of the CFC correct? Can I return the values into to local scope of the CFC function? Thanks Yes, to all of the above. A demonstration: Testing.cfc: <cfcomponent> <cfset Variables.Instance = {} /> <cffunction name="checkTheScopeYo" returntype="Struct"> <cfset var LOCAL = {} /> <!--- Call a CFModule ---> <cfmodule template="TestModule.cfm" /> <cfset Variables.theLocal = LOCAL /> <cfreturn Variables /> </cffunction> </cfcomponent>

Can cfmodule return values to caller's local scope?

不打扰是莪最后的温柔 提交于 2019-11-30 17:11:37
问题 Inside the cfm of the cfmodule, values are returned through the use of Caller scope. If I call a cfmodule inside a function in a CFC, Caller maps to the Variables scope of the CFC correct? Can I return the values into to local scope of the CFC function? Thanks 回答1: Yes, to all of the above. A demonstration: Testing.cfc: <cfcomponent> <cfset Variables.Instance = {} /> <cffunction name="checkTheScopeYo" returntype="Struct"> <cfset var LOCAL = {} /> <!--- Call a CFModule ---> <cfmodule template=

ColdFusion 9 Dynamic Method Call

妖精的绣舞 提交于 2019-11-29 07:32:29
I am trying to work out the correct <cfscript> syntax for calling a dynamic method within ColdFusion 9. I have tried a number of variations and had a good search around. <cfinvoke> is clearly the tag I want, sadly however I cannot use this within my pure cfscript component as it was implemented in ColdFusion 10. i.e coldfusion 9 dynamically call method I have tried the following within my CFC: /** Validate the method name **/ var resources = getResources(); if (structKeyExists(variables.resources, name)) { variables.resourceActive[name] = true; var reflectionMethod = resources[name]; var

ColdFusion 9 Dynamic Method Call

空扰寡人 提交于 2019-11-28 01:12:39
问题 I am trying to work out the correct <cfscript> syntax for calling a dynamic method within ColdFusion 9. I have tried a number of variations and had a good search around. <cfinvoke> is clearly the tag I want, sadly however I cannot use this within my pure cfscript component as it was implemented in ColdFusion 10. i.e coldfusion 9 dynamically call method I have tried the following within my CFC: /** Validate the method name **/ var resources = getResources(); if (structKeyExists(variables

Mapping to a CFC in ColdFusion

ぐ巨炮叔叔 提交于 2019-11-27 21:27:13
In my application I have all my CFC's in a cfc folder. From the site root I can access them without any trouble by simply referring to them in my <cfinvoke> tag as component=cfc.mycomponent method=mymethod The trouble is, when I want to access the cfc from another page that's not in the root I can't use component=../.cfc.mycomponent to get in touch with that cfc. What am I doing wrong here? There are a handful of options for getting this to work. Unfortunately, learning them has taken me a good amount of trial and error. Let me share what I've learned. First , you can use the classic method of

Extending application.cfc in a subdirectory

一世执手 提交于 2019-11-27 20:14:11
I have the following two files and would like the second to extend the first: wwwroot\site\application.cfc wwwroot\site\dir\application.cfc However, when I go to declare the component for the second file, I'm not sure what to put in the extends attribute. My problem is that several dev sites (with a shared SVN repository) are running off the same instance of ColdFusion , so I can't just create a mapping in the CF admin like so: <cfcomponent extends="site.application"> However, ColdFusion doesn't like: <cfcomponent extends="..application"> or any dynamic input like: <cfcomponent extends="

Extending application.cfc in a subdirectory

拜拜、爱过 提交于 2019-11-27 04:25:44
问题 I have the following two files and would like the second to extend the first: wwwroot\site\application.cfc wwwroot\site\dir\application.cfc However, when I go to declare the component for the second file, I'm not sure what to put in the extends attribute. My problem is that several dev sites (with a shared SVN repository) are running off the same instance of ColdFusion , so I can't just create a mapping in the CF admin like so: <cfcomponent extends="site.application"> However, ColdFusion