I'm trying to get out of MX non CFC world. I've now working with CF8 and
want to start converting some of my things to use CFC's. Specifically how I
can use forms to interact with CFC's to add/edit/delete data. I've read a
few tutorials from adobe about them and what I've seen on a few blogs
ask and you shall be enlightened:
http://www.bennadel.com/blog/726-ColdFusion-Application-cfc-Tutorial-And-Application-cfc-Reference.htm
~|
Want to reach the ColdFusion community with something they want? Let them know
on
ask and you shall be enlightened:
http://www.bennadel.com/blog/726-ColdFusion-Application-cfc-Tutorial-And-Application-cfc-Reference.htm
While that's useful information to be sure, it doesn't address the
original poster's question, which is about CFC use in general.
Application.cfc is quite a
To: cf-talk
Subject: Re: CFC Newbie
ask and you shall be enlightened:
http://www.bennadel.com/blog/726-ColdFusion-Application-cfc-Tutorial-And-App
lication-cfc-Reference.htm
While that's useful information to be sure, it doesn't address the
original poster's question, which is about CFC use
Yep read those first Ben!
-Original Message-
From: Ben Forta [mailto:b...@forta.com]
Sent: Monday, March 22, 2010 3:49 PM
To: cf-talk
Subject: RE: CFC Newbie
These are old, but may answer the question:
http://www.adobe.com/devnet/coldfusion/articles/intro_cfcs.html
http
Yes, encapsulation is an important part of OO and yes many people don't care.
If you want to maintain the encapsulation, don't set thigns in the
THIS scope - use a setter method to set them in the VARIABLES scope
(and a getter method to get them out again):
cfscript
newUser =
What about the constructor function? Shouldn't I set the properties in
the THIS scope when initializing a component?
Also, what is the difference between the variables scope and the
arguments scope withing a method? I have seen properties defined using
the cfargument tag referenced in the method
The only use for THIS in an OO-based component is to return THIS at
the end of the constructor. That returns the entire component for use
as an instance.
The properties will be in the VARIABLES scope; they can be used via
getter and setter methods. This is where the ARGUMENTS scope comes in
- the
The only use for THIS in an OO-based component is to return THIS at
the end of the constructor. That returns the entire component for use
as an instance.
In Java, the constructer is for providing arguments with default
values. These default values can be the ones that are automaticly
assigned
No, for the moment, forget THIS.
cfargument name=this.name type=string default=
cfset variables.name = this.name
should be
cfargument name=name type=string default=
cfset VARIABLES.name = ARGUMENTS.name
The life cycle of the instance depends on where you put it.
Instantiate it in the session
James,
I am going to keep all of these threads, print them out, and go over
them multiple times until I begin to grasp it all. I guess I won't be
learning CFAJAX until I get CFC's down, which is proving to be quite a
task and very lengthy process.
Thanks again and again!
-Aaron
To instantiate
Aaron Roberson wrote:
I am going to keep all of these threads, print them out, and go over
them multiple times until I begin to grasp it all. I guess I won't be
learning CFAJAX until I get CFC's down, which is proving to be quite a
task and very lengthy process.
CFCs are wonderful!
If you
Thanks Rick, I will surely take a look.
-Aaron
On 2/16/06, Rick Root [EMAIL PROTECTED] wrote:
Aaron Roberson wrote:
I am going to keep all of these threads, print them out, and go over
them multiple times until I begin to grasp it all. I guess I won't be
learning CFAJAX until I get
On 2/17/06, Aaron Roberson [EMAIL PROTECTED] wrote:
In my Java book it says that if a method is public, a data filed could
be assigned a value directly, BUT doing so violates an important
principle of object-oriented programming -- that of data hiding using
encapsulation.
However, I have
it looks like it is specifically coded to run from the calendar
folder. Try creating a calendar folder and dropping all the files in
that and running it again.
I dropped the folder that unzipped from the download, into my webroot.
called /calendar/sample/index.cfm and the whole app came to
Let me point out the scope bug...
using this scope exposes your data members outside of the cfc. In
addition, the varibales scope is not the default for not providing a scope
within a CFC. There is something known as the unknown scope. This unknown
scope allows data members to be available to
In terms of which is the most efficient way of calling a cfcs... I like to
use
CreateObject(objectname,component);
Thinking about CFCs like classes in Java or C++ is natural for me, so I like
to work in that mentality.. like Hal Helms points out.
Keep in mind though, some hosting providers limit
not unknown... obviosuly its known :-) known as nothing!
That should read the unnamed scope.
Sorry If I confused matters...
- Original Message -
From: Michael Tangorre [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 1:32 PM
Subject: Re: CFC Newbie
Skinner
Web Programmer
BloodSource
Sacramento, CA
-Original Message-
From: Michael Tangorre [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 10:32 AM
To: CF-Talk
Subject: Re: CFC Newbie Discussion.
Let me point out the scope bug...
using this scope exposes your data members outside
Thinking about CFCs like classes in Java or C++ is natural for me, so I
like
to work in that mentality..
it might be more efficient to think of CFCs like CFCs, that way you can use
their features effectively, and not be disappointed or disillusioned if CFCs
do things you dont expect or dont do
cfobject name=testObj component=test
cfdump var=#testObj#
cfset this.X = 12
cfset this.Y = 24
This part confuses me...this scoped variables refer to the object they
are contained within. It looks like you are setting them outside of a
cfc. All that will do is create a structure called this,
, and probably for a person new to CFCs, keeping them
focused on CFCs and not the relations to OO would be a good start.
Mike
- Original Message -
From: John Quarto-vonTivadar [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 1:53 PM
Subject: Re: CFC Newbie
hall [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:01 AM
To: CF-Talk
Subject: Re: CFC Newbie Discussion.
cfobject name=testObj component=test
cfdump var=#testObj#
cfset this.X = 12
cfset this.Y = 24
This part confuses me...this scoped variables refer to the object they
are contained
While I strongly urge folks to not use the This scope, I would _not_
call it a bug. The This scope works _exactly_ as advertised, it's just
not the preferred way of storing data for a CFC.
-Raymond Camen
Let me point out the scope bug...
using this scope exposes your data members outside
So what is the Preferred way to store data for a CFC?
--
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:20 AM
To: CF-Talk
Subject: RE: CFC Newbie Discussion.
While I
The this scope has always worked exactly as I expected, and I do
prefer to use it to store data unless there is a specific reason not to.
--
jon
mailto:[EMAIL PROTECTED]
Tuesday, June 10, 2003, 2:20:22 PM, you wrote:
RC While I strongly urge folks to not use the This scope, I would _not_
RC
Here is a summary from a few previous emails:
1. Define properties(variables) as instance.X to prevent any outside view
or editing of them.
2. Use getX methods to allow outside viewing, and setX methods to set
the variable.
3. Define non-property variables used with each method through
]
Sent: Tuesday, June 10, 2003 2:30 PM
Subject: RE: CFC Newbie Discussion.
So what is the Preferred way to store data for a CFC?
--
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: Tuesday
On Tuesday, June 10, 2003, at 02:20 PM, Raymond Camden wrote:
While I strongly urge folks to not use the This scope, I would _not_
call it a bug. The This scope works _exactly_ as advertised, it's just
not the preferred way of storing data for a CFC.
Raymond is correct. It is not a bug --
, and a powerful ally it is. - Yoda
-Original Message-
From: Christian Cantrell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 12:40 PM
To: CF-Talk
Subject: Re: CFC Newbie Discussion.
On Tuesday, June 10, 2003, at 02:20 PM, Raymond Camden wrote:
While I strongly urge
/cfcomponent
In this example, I get an error stating that the variable A is not defined?
--
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-Original Message-
From: Christian Cantrell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:40 AM
To: CF-Talk
Subject: Re: CFC
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 12:49 PM
To: CF-Talk
Subject: RE: CFC Newbie Discussion.
Ahh, I understand now, the best practice we are talking about
is protecting the state/variables of ones objects, but using
private variables and functions to manipulate them
.
Hope this helps you.
Mike
- Original Message -
From: Ian Skinner [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 2:49 PM
Subject: RE: CFC Newbie Discussion.
Ahh, I understand now, the best practice we are talking about is
protecting
the state
: Tuesday, June 10, 2003 11:57 AM
To: CF-Talk
Subject: Re: CFC Newbie Discussion.
You are asking all the right quesitons to learn... keep asking. :-)
to keep variables protected within functions, use:
cfset var myvariable = something
to keep variables protected to the cfc and functions within the cfc
on 6/10/03 2:55 PM, Raymond Camden at [EMAIL PROTECTED] wrote:
By the way, there is one more scope you should be convered with - and
that is 'var' scoped method variables. Whenever you use a value in a
method, a value that is NOT meant to exist in the CFC whole, you should
use the var scope.
So this example was meant to show how to protect variables
inside the method? If I follow correctly, you created a
variable scoped to the 'var' scope (named myQuery), then
set the variable equal to the value of the Query? Does this
mean that, if I follow what you say below...
Correct.
of the entire component?
--
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 12:38 PM
To: CF-Talk
Subject: RE: CFC Newbie Discussion.
So this example was meant to show how
Two follow up questions. You can't directly use the var key
word in the cfquery tag; cfquery name=var joe
Correct. You also can't do cfset var ... after any line of real code.
So, your first N lines of a method will be cfargument tags, then cfset
var tags, then 'real' code.
So,
cfinvoke component=com.locavista.gui method=header
That should read com.local.gui sorry, mis-typed into Outlook, so still
broken...
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
create a CF mapping for 'com'
-Original Message-
From: Thomas Chiverton [mailto:thomas.chiverton;locavista.com]
Sent: Friday, October 18, 2002 11:05 AM
To: CF-Talk
Subject: RE: CFC newbie
cfinvoke component=com.locavista.gui method=header
That should read com.local.gui sorry, mis
: RE: CFC newbie
create a CF mapping for 'com'
-Original Message-
From: Thomas Chiverton [mailto:thomas.chiverton;locavista.com]
Sent: Friday, October 18, 2002 11:05 AM
To: CF-Talk
Subject: RE: CFC newbie
cfinvoke component=com.locavista.gui method=header
That should read com.local.gui
create a CF mapping for 'com'
Ahh, great ! That was it.
Friday brain fade - the sub dir I was in was mapped, so the 'com' directory
I created was in the wrong place. Moving it to the actual wwwroot worked a
treat.
Tom Chiverton
You don't have to be a mad scientist to believe in ColdFusion
=com.locavista.gui.header method=someMethod
-Original Message-
From: Michael Corbridge [mailto:mcorbridge;macromedia.com]
Sent: Friday, October 18, 2002 10:21 AM
To: CF-Talk
Subject: RE: CFC newbie
create a CF mapping for 'com'
-Original Message-
From: Thomas Chiverton
Ali,
Here is a stripped down version of your cfc that works with the native 'exampleapps'
datasource that is shipped with CFMX.
Notes:
You have set the method access='private' which means that method can only be called
from another method in the component. When starting out with cfc's, I
h...
all the example code was removed from my previous email.
I'll try again.
cftalk1.cfm
---
cfinvoke component=cftalk1 method=sendMail emailid=Raymond
returnVariable=r_return
cfdump var=#r_return#
cftalk1.cfc
: cfjedimaster
My ally is the Force, and a powerful ally it is. - Yoda
-Original Message-
From: Michael Corbridge [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 05, 2002 8:18 AM
To: CF-Talk
Subject: RE: CFC newbie question
h...
all the example code was removed from
You forgot you # signs...
cfmail subject=queryemail.tblemails_subject
to=queryemail.tblemails_to
from=queryemail.tblemails_from
should be
cfmail subject=#queryemail.tblemails_subject#
to=#queryemail.tblemails_to#
from=#queryemail.tblemails_from#
Not a CFC issue - just a
47 matches
Mail list logo