Skip to main content
Inspiring
May 27, 2008
Question

method cfc question

  • May 27, 2008
  • 8 replies
  • 649 views
According to guru Hal Helms in his tutorial about cfcs when he is introducing methods in cfcs (the free sample chapter from his book on his website) I should get an error saying Element SALARY is undefined in VARIABLES. But I don't. I imagine it is becuase I am using cfmx7 but I would be greatful if someone could explain why it WORKS in this version what adobe or macromedia did that makes it work! Thanks in advance

Here's the simple code:(just updated it I left off the parentheses on the c.test() var typo sorry but the question is still the same!)
This topic has been closed for replies.

8 replies

Inspiring
May 30, 2008
right i got in contact with his it seems that the rest of his tutorials don't work either which is a shame as he does have a really easy way of explaining things-let's hope he sorts it out asap!
Inspiring
May 30, 2008
yeah I'll get on that. cheers Adam
Inspiring
May 29, 2008
> thank you for those replies and explanations, the tutorial is at http://halhelms.com/webresources/samplechapter.pdf

That tutorial is a load of ballocks.

In Helms' defence, I'm fairly certain it's down to my earlier suspicion
that it was written for CFMX6.0's flavour of CFCs, which was revised
heavily for 6.1. Everyone was caught out by that curve ball.

It might be worth you dropping him a line and asking him to take it down,
though.


Anyway, I recommend you find a different tutorial. I'm not sure what to
suggest, but I'm sure others will pitch in with ideas.

Personally, I just read the docs on livedocs:
http://livedocs.adobe.com/coldfusion/8/buildingComponents_01.html

and reading the notes on all the relevant tags.

--
Adam
Inspiring
May 29, 2008
thank you for those replies and explanations, the tutorial is at http://halhelms.com/webresources/samplechapter.pdf
Inspiring
May 28, 2008
> Does it output 20000 or #variables.salary#? I'm guessing the latter.

The output="yes" in the <cffunction> tag makes it an implicit <cfoutput>
tag.

--
Adam
Inspiring
May 28, 2008
> According to guru Hal Helms in his tutorial about cfcs

Which one is this?

Some of Helms' early CFC stuff is "wrong", because it was written during
the beta phase of CFMX6.0, and the CFC implementation was heavily revised
for CFMX6.1, making most of the info on CFCs predating 6.1 invalid.


> I should
> get an error saying Element SALARY is undefined in VARIABLES.

If that's what he says, I'd stop using the tutorial straight away.

What you are seeing is what one should expect (ie: the advice is wrong; CF
is right).



> <cfoutput>#c.test#</cfoutput>

I presume this is a typo, and you mean to have:
<cfoutput>#c.test()#</cfoutput>

--
Adam
Inspiring
May 28, 2008
nope I get 200000!!
Inspiring
May 27, 2008
Does it output 20000 or #variables.salary#? I'm guessing the latter.