cfc

ColdFusion: Is it safe to leave out the variables keyword in a CFC?

In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: <cfcomponent> <cfset variables.foo = "a private instance variable"> <cffunction name = "doSomething"> <cfset var bar = "a function local variable"> <cfr...

Extend a CFC using a relative path

I want to extend a CFC in a different directory and I have a couple of options, but can't figure out how to do this: A) Use a dynamic mapping (this will have to be dynamic based on the site, e.g. for the live site it would be cfc.myPackage.MyCFC but on a dev site it would be myCfcRoot.myPackage.MyCFC) - I've tried putting expressions in...

Extending application.cfc in a subdirectory

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 runnin...

remoteObject Fails After Recompiling Using CF8

I've been handed a Flex project that was originally built and compiled using Flex3 and CF7. My setup is Flex3 with CF8. Everything works fine when I initially pull the project over but as soon as I recompile, remote calls to the CFCs begin to fail. I used Charles Web Proxy debugger and discovered that the failure appears to begin with...

Collection of ColdFusion CFC Best/Recommended Practices?

I have been building a list of CFC best practices to share. There are a numerous of articles out there but I thought it might be neat to get any tricks and tips together here in one place that have been learnt through experience. I'll add a few links here to get it going but I think the best thing would be not long articles that can be...

flex: Save an editable datagrid via a cfc

Hi I have an editable datagrid which i need to be able to save with other form fields via a cfc in coldfusion. Basically the aim is that there are a number of locations retrieved via an RO which make up the first column the remaining columns are types of data i.e. demographics, client notes, appointments etc, the idea is that the user...

Flex Coldfusion CFC location

I'm a Coldfusion developer looking to break into Flex. I have a couple test Flex applications i'm working on, but am having problem connecting to my CFC's. I've tried creating mappings in CFAdmin, putting the CFC in the same folder as the Flex app, putting the CFC in the C:\Coldfusion8\Gateway\CFC folder, all to no avail. Each time, I...

xsd for wsdl in coldfusion

How to generate an xsd from the wsdl generated in Coldusion? I'm no sure how the xsd is useful for creating SOAP stub but someone needs it so need to find a way to generate one. I tried using some online tools for this but it says "inline definitions". Hopefully some one knows how to do this. ...

Is it possible to test an object against a component type and/or inherited type?

What I am trying to do is test an object in ColdFusion to see what type of component it is. Something like... <cfif isValid( "compath.dog", currentObj)> ...do something specific with dog objects... </cfif> I thought this was possible but receive an error saying the type I am passing does not correspond to one in the valid list of ...

How to protect access="remote" funcitons in CFCs from snoopers?

One of the great features of CFCs is the ability to reuse the code for both a straight .cfm page and for Flex apps. One such app that I devleoped uses Flex for it's charting capabilities and needs access to a 'getResults()' function in the cfc. All of this content is behind an authentication mechanism, but since the cfc will open itsel...

Is it possible to dynamically populate a CFC with arguments?

The following code errors: <cfdbinfo datasource="#Application.DSN#" name="getCols" type="columns" table="#this.tableName#"> <cftry> <cfquery name="getColumnDetails" dbtype="query"> SELECT COLUMN_NAME,TYPE_NAME FROM getCols WHERE IS_PRIMARYKEY = 'NO' </cfquery> <cfcatch> <cfset this.ErrorState = true> <cfthrow m...

Coldfusion Class definition error. Where is the problem?

I have the following Applicaton.cfc <cffunction name="onApplicationStart" access="public" returntype="Object"> <cfset application.dsn = "myDB" /> <cfset application.userGateway = createObject("component","cfc.UserGateway").init(dsn = application.dsn) /> <cfreturn this /> </cffunction> This is my component UserGateway.cfc <cfcompon...

Ajax requests, through MVC Framework (e.g. ColdBox) or not?

Do you fire ajax requests through the MVC framework of choice, or directly to the CFC? I'm leaning towards bypassing the MVC, since I need no 'View' from the ajax request. What are the pro's of routing ajax calls through MVC framework, like Coldbox? update: found this page http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbAjaxHin...

Can CFTHREAD be used for LDAP housekeeping?

Can I keep two records in LDAP in sync using CFTHREAD? I need to check if a record is still valid by looking up a cn elsewhere. So if it is invalid I want to delete it. This means getting all current records of the type I want, deleting them all and adding them all again (minus the one I dont want) ...

Can you reassign the default <cfargument in a cfc?

I'm invoking a cfc, the cfc has a default set of arguments like so: <cfargument name="EMAIL_TEMPLATE_CODE" type="string" required="yes" hint="EMAIL_TEMPLATE_CODE is required."> <cfargument name="EMAIL_TEMPLATE_SUBJECT" default="" type="string" required="no" hint="EMAIL_TEMPLATE_SUBJECT is NOT required."> <cfargument name="EMAIL_TEMPLATE...

Flex RemoteObject Source not found

Our flex project, which works fine in its current environment with coldfusion 7 single server. We moved this project to Coldfusion 8 multi server, and updated the remoteobject paths relative to the web root. The error we now receive is faultCode:Server.Processing faultString:'Unable to invoke CFC - Could not find the ColdFusion Comp...

Flex 3 / Coldfusion 8 Problem with Numbers

We recently migrated from coldfusion 7 to coldfusion 8. One of our reporting flex apps takes the returned results of a cfc query and adds up a column in that ArrayCollection. It worked on coldfusion 7, but now, in coldfusion 8, it sees that column as a string instead of a number, which is causing NaN errors on negative values. Its a nume...

combobox dataprovider

I have the following: <mx:RemoteObject id="myCFC" destination="ColdFusion" source="components.myCFC" showBusyCursor="true"> <mx:method name="getStuff" result="UserHandler(event);"/> </mx:RemoteObject> ... <mx:ComboBox id="propertyCode" dataProvider="{qry_stuff}" labelField="name" /> Index.as has: [Bindable] public var qry_...

question about coldfusion displaying query result in a cfgrid

hi guys, i have a coldfusion cfc and some methods in it. MethodA will return a cfquery object. now i use cfajaxproxy to call MethodA and get the query result in a cfm page. this cfm page already have a cfgrid there. now my question is how can i display the query result getting from MethodA in the grid which already have data display in i...

how to get Exception details from CFC file

I have a Function in CFC file, which will be called from .cfm file like below <cffunction name="cftest" access="public" returntype="query" output="true" hint="Function returns Records"> <cfquery name="qryTest" datasource="DBTest"> select * from emp_tab; </cfquery> <cfreturn selectRecordsResultSet /> ...