Do you have enable session management checked in the ColdFusion admin
on your production box, and session management enabled in your
Application.cfc?
Rick Faircloth wrote:
I'm trying to set session variables for login with the code below.
It works fine on my local dev pc, but on the
'
as determined with an cfapplication... tags with the same 'name'
property. How this affects components is that they are often placed in
directories outside the normal web directories and thus are not under
the usual Application.cfm|.cfc file that defines that application name.
This is easy to fix
. Firebug tells me all templates are
being accessed...and this setup works on my dev pc...
Rick
-Original Message-
From: Scott Stewart [mailto:saste...@email.unc.edu]
Sent: Wednesday, January 07, 2009 9:43 AM
To: cf-talk
Subject: Re: Is this acceptable or reasonable CFC usage?
Do
couldn't seem to get the data in there.
I'm returning the data in managerStruct for the purposes of logging in.
The other data just sets permissions for the user.
Here's the CFC I'm using. Do you see any issues? How would I change it
to include the permissions in the struct? One thing that may
Actually, looking at the code, I would say that the user you're logging in as
simply doesn't exist in your production database. The session sets are in a
CFIF block ... if there's not a valid record in the login Query, it's not
setting the session, right?
I just tried it and my CFC is still returning the JSON content but it seems
like it still appears to be a string rather than an object. I'm using this:
//var wsURL =
'/ws/emp.cfc?method=getEmpInforeturnFormat=jsonsearchParam=101';
var wsURL =
'http
Yes, it can. In your Ajax call parameters include returnFormat:'JSON',
and ColdFusion will automatically serialize your function's return as a
JSON object.
Steve Cutter Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer
Co-Author of Learning Ext JS
You can do something like this, have your Jquery call a CFM page that calls
the CFC component.
script type=text/javascript
$(document).ready(function() {
// Call Ajax -
$.ajax({
type: POST,
url: act_Call_StatesCities.cfm, //
dataType: json,
beforeSend: function(XMLHttpRequest
Um, JSON _is_ a string. It's not an object until the front end
evaluates the string. jQuery can handle all of that for you though.
Also, you used format=json. You need to use returnFormat.
On Tue, Jan 6, 2009 at 8:44 AM, Joe joe_ts...@hotmail.com wrote:
I just tried it and my CFC is still
I'm helping a friend migrate a site over to a new host, and the old host is
being very uncooperative. We seem to be missing a couple of CFC's. The most
important one is cf_magicktag. I've seen it discussed on different boards, but
I'm having trouble finding this online. Can anyone help?
I am trying it an it's not working.
Here is a snippett. Is this possible?
I am looping over form fields and trying to invoke the cfc for each item in the
list.
cfloop index=i list=#form.#
cfinvoke
component=X
method=XXX
returnvariable=X
cfinvokeargument
is a snippett. Is this possible?
I am looping over form fields and trying to invoke the cfc for each item in
the list.
cfloop index=i list=#form.#
cfinvoke
component=X
method=XXX
returnvariable=X
cfinvokeargument name=userID
Invalid arguments passed - it's a custom error
Should work just fine, CFINVOKE doesn't really care how it's called,
just that it has the right attributes/arguments. What's the error
you're getting?
cheers,
barneyb
~|
Can i output the arguments passed to the cfc?
Should work just fine, CFINVOKE doesn't really care how it's called,
just that it has the right attributes/arguments. What's the error
you're getting?
cheers,
barneyb
Then it's getting called successfully and your in-method checking is
erroring. Probably have something wrong with the way you're
extracting the dynamic arguments. But the CFINVOKE itself is working.
Can you comment out the CFINVOKE and just CFOUTPUT the arguments that
you're passing so you can
I've tried to output the arguments but don't know the syntax.
Do you know?
Then it's getting called successfully and your in-method checking is
erroring. Probably have something wrong with the way you're
extracting the dynamic arguments. But the CFINVOKE itself is working.
Can you comment
If you've got this:
cfloop index=i list=#form.#
cfinvoke
component=XXX
method=YYY
returnvariable=ZZZ
cfinvokeargument name=userID
value=#sessionRead.userID#/
cfinvokeargument name=courseID value=#i#/.
just change it to this:
cfloop index=i
Ok you mean just output the form variables?
They seem to be ok. The loop is working when I insert one record. It's the
multi insert that is not working.
If you've got this:
cfloop index=i list=#form.#
cfinvoke
component=XXX
method=YYY
returnvariable=ZZZ
cfinvokeargument
All,
I recently created a small CFC returning query results in JSON format. The
querying works, the regular CF page is able to call the CFC as a WSDL page
properly passing params, and I am getting back JSON-like content. However I
have been unable to parse the JSON content like an array within
are using jQuery and all, but the cfajaxproxy tag makes what
you are doing simpler because it does all that stuff for you.
Also, if you want your web service cfc to be reusable in instances where
JSON is not the desired return type I believe you can use the
returnformat=json in the URL instead
-Query-Json-Data-Reader
Judah
On Mon, Jan 5, 2009 at 11:42 AM, Joe joe_ts...@hotmail.com wrote:
All,
I recently created a small CFC returning query results in JSON format. The
querying works, the regular CF page is able to call the CFC as a WSDL page
properly passing params, and I am getting
You don't want to call your local CFC with ?wsdl. That's the web
service URL. You want to just call the CFC with it's normal name, and
pass the method and the returnFormat argument. So your url should be
something like:
url=my.cfc?method=somemethodreturnformat=json
This will run the somemethod
The reason I'm making a web service is b/c I want the JSON to be parsed by
jQuery. Are you telling me client-side Javascript can handle CFCs?
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
a JSON response.
You can call any CFC, under web root, with just the url. Try it. Put
this CFC under your web root:
cfcomponent
cffunction name=sayHi access=remote returnType=string
cfreturn Ray roxors
/cffunction
/cfcomponent
If you name this test.cfc, and put it in web root, open your browser
Since switching to ColdFusion 8, I noticed some weird issues with the returned
error messages from the CFC. Let's say I call my login function from my Flex
app, and the username and password are incorrect. The ColdFusion code would
throw the following error:
cfabort showerror=You have entered
For the life of me I can't figure out how to stop this error.
Sometimes when I call the page that invokes the CFC, It gives an
error: Error invoking CFC . It does not happen all time though. 8
times out of ten it will load fine, then throw the error every once an
a while.
It's almost like
More on this...
Ok, more on this. I'm using CFSelect and binding to this cfc.
cfselect name=model id=model
value=model
display=model
bind=cfc:model.getdata.getmodels()
class=input
multiple=no
bindonload=true /
Is there any odd issues
that invokes the CFC, It gives an
error: Error invoking CFC . It does not happen all time though. 8
times out of ten it will load fine, then throw the error every once an
a while.
It's almost like the framework is sleeping, and can't load things
quick enough before an error is thrown.
I'm on a VPS
Is that it for the error? Any other details to go by? Did you check the log
file to see if there were any other details?
The complete error is:
Error invoking CFC /model/getfitmentdata.cfc : Internal Server Error [Enable
debugging by adding 'cfdebug' to your URL parameters to see more
invoking CFC /model/getfitmentdata.cfc : Internal Server Error
[Enable debugging by adding 'cfdebug' to your URL parameters to see more
information]
Not much more help.
I'll check the logs now.
~|
Adobe® ColdFusion® 8
Add cfdebug to your URL parameter and it will pop up the AJAX debugger.
On Thu, Nov 20, 2008 at 5:51 PM, Jeff F [EMAIL PROTECTED] wrote:
Logs don't help. They just point to that getmodels.cfc.
I'm wondering if my cfc is at fault. It's querying a rather large table.
Possibly taking too long
:
Logs don't help. They just point to that getmodels.cfc.
I'm wondering if my cfc is at fault. It's querying a rather large
table. Possibly taking too long?? I'm going to add
CachedWithin=#CreateTimeSpan(1,0,0,0)# to see if that helps.
cffunction name=getmodels access=remote
My conclusion was that CFCs treated as function libraries incurred
unnecessary overhead while offering no additional benefit over a pre-CFC
function library.
Because you were creating the object each time? You could have cached it.
Adrian
Building a database of ColdFusion errors at http
Do CFC's have some sort of internal validation routine associated with them?
I'm running my form data through the validation CFC and all checks out then
returns to the calling page and the email_processing CFC is called and I get
data formatting errors. ???
For example, I have a text input
Kinda hard to tell you what's wrong without some code.
Adrian
-Original Message-
From: Rick Faircloth
Sent: 02 November 2008 12:36
To: cf-talk
Subject: Re: CFC and Form Variables Question
Do CFC's have some sort of internal validation routine associated with them?
I'm running my form
Yeah, I know... I was trying not to get to deep into the code since it
involves so many parts, but here' s shortened version:
-
cma.cfm (calling page)
cfset form_errors = structNew() - you are not VAR'ing your cfc variables, so
some var leaking/confusion may be going on...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Rick Faircloth wrote:
Yeah, I know... I was trying not to get to deep into the code since it
involves so many parts
causing the problem, the form
processes normally.
Rick
Azadi Saryev wrote:
cfset form_errors = structNew() - you are not VAR'ing your cfc variables,
so some var leaking/confusion may be going on...
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Rick Faircloth wrote:
Yeah, I
::-Original Message-
::From: Rick Faircloth [mailto:[EMAIL PROTECTED]
::Sent: Sunday, November 02, 2008 7:18 AM
::To: cf-talk
::Subject: Re: CFC and Form Variables Question
::
::Hi, Azadi, and thanks for the feedback.
::
::I tried every combination I could think of...modifying variables
, November 02, 2008 7:18 AM
::To: cf-talk
::Subject: Re: CFC and Form Variables Question
::
::Hi, Azadi, and thanks for the feedback.
::
::I tried every combination I could think of...modifying variables in
::the form_validation.cfc as well as the email_processing.cfc, but nothing
::changed
It seems that CF didn't like having variables named with two underscores
in them.
I had these four field names that were causing problems.
- home_phone
- home_phone_time
- work_phone
- work_phone_time
Once I changed them to...
- home_phone
- home_calltime
- work_phone
-
But I'm using form..., not cfform Would that cause CF validation
to be triggered, as well?
Rick
Dave Watts wrote:
It seems that CF didn't like having variables named with two underscores
in them.
I had these four field names that were causing problems.
- home_phone
- home_phone_time
I don't think that's exactly it. There are a bunch of automatic
validation suffixes, like _date and _time which trigger built-in
CF form validation. Typically, they're used by adding hidden form
fields to your form, and naming those fields using the names of the
fields to be validated and the
Thanks for the info, Dave. I guess I've just not used the right (or wrong)
variable names to trigger that auto-validation. I recall seeing it
now...just never
made use of it, preferring to write my own. But I'll look into it. It
may make
validation easier for many types of data.
Rick
Dave
If you ever build a facebook application with ColdFusion you will run
into this exact same problem. Basically, Facebook send a post request
to your server which always breaks because there are two important
fields called FB_SIG_TIME and FB_SIG. ColdFusion tries to validate
FB_SIG as a time field,
Thanks for the info, Dominic!
Rick
Dominic Watson wrote:
If you ever build a facebook application with ColdFusion you will run
into this exact same problem. Basically, Facebook send a post request
to your server which always breaks because there are two important
fields called FB_SIG_TIME
Hi, all...
Can form variables be passed around between a calling page and
multiple cfc's?
I have a form with data I want to validate, then generate an email with.
I have the calling page with the form, which sends the form data via
argumentCollection,
to a form_validation.cfc. If the form
Something like this?
cfif someObject.validateTheForm(argumentCollection = form)
cfset variables.foo =
anotherObject.doSomethingWithForm(argumentCollection = form) /
cfelse
Form did not validate
/cfif
Or, are you wanting to pass the form data to another cfc method from
within
Hi, Dominic and thanks for the reply...
The second option sounds more like what I'm wanting to do.
And while reading your response, it occurred to me that if I
send the form data to a cfc for validation, and it validates,
I could just go straight to another method (how about to another cfc
and acts accordingly.
As for 'sharing' variables between arguments within a single cfc, I'd
say you would always want to use the arguments scope for passing the
data around. Both these choices make for maximising the reusability of
your code.
Consider:
cfcomponent output=false
cfset variables
= arguments.adminEmail /
cfreturn this /
/cffunction
And:
As for 'sharing' variables between arguments within a single cfc...
Should read: As for 'sharing' variables between *methods* within a
single cfc...
! Dominic
2008/11/1 Dominic Watson [EMAIL PROTECTED]:
Personally, I'd prefer
Taking a step back, why are you using a form validation CFC? Your goal
is that you want to validate a form then send an email. So the simple
way to do this is to post the form to itself, then at the top of the
page detect whether the page is posted to itself, run it through some
validation checks
' variables between arguments within a single cfc...
Should read: As for 'sharing' variables between *methods* within a
single cfc...
! Dominic
2008/11/1 Dominic Watson [EMAIL PROTECTED]:
Personally, I'd prefer the first approach. The validation method
should only be concerned
why are you using a form validation CFC?
No specific reason for using a CFC, except that I can put all my form
validation
routines into a single CFC easily enough.
My normal practice is to have a page submit back to itself (and even
with a CFC
or two involved, I still do that), but I've been
To more specifically answer your question, avoid the variables scope
inside of a CFC if you can. You can use that, but it is generally
considered bad design and it can lead to problems that are hard to
troubleshoot.
The variables scope should not be used for what Rick was suggesting
I'm considering taking the approach of making the appropriate email
routines that
follow validation routines, children (I think that's the term) of the
validation routines
so there's only one call from the calling page and then the data flows
through the
process of validation and emailing, then
this thread. I
was just unsure
of whether each independent CFC called would have access to the form
variables.
Here's what my code looks like (I coded these calls when my question
about access
to form variables in the two different CFC's occurred to me...)
cfif isDefined(form.fieldnames
function is something that could be part of
one of those objects. For example, if you consider your form to be an
object, then a this.validate() method would be part of the form object
and you wouldn't need to pass the form data en-mass to another CFC
since you are staying within the same object
You're right, Mike...
I'm just using the CFC as more of a function library, not so much from
an OOP standpoint. (I only learned to use CFC's effectively in the last
week or so :o)
I'll have to dig into the this.validate() method a little more to
understand it.
I did see it discussed
overhead while
offering no additional benefit over a pre-CFC function library. With
CF8 things are different in that CFCs in CF8 are much faster, plus
they play nice with technologies such as AJAX and Flex.
Going back to your original question, you can pass the form structure
into a CFC function if you
that as the direction CF was
headed and it was the hot new feature. My conclusion was that CFCs
treated as function libraries incurred unnecessary overhead while
offering no additional benefit over a pre-CFC function library. With
CF8 things are different in that CFCs in CF8 are much faster, plus
they play
Building a database of ColdFusion errors at http://cferror.org/
-Original Message-
From: Rick Faircloth
Sent: 30 October 2008 01:30
To: cf-talk
Subject: cfreturn 2 query values from CFC?
Hi, all...
If I'm running two queries inside a function,
how do I return both query values?
Query 1
Thanks for the tip, Adrian!
Rick
Adrian Lynch wrote:
This:
cfset var returnStruct = StructNew()
cfset returnStruct.query1 = query1
cfset returnStruct.query2 = query2
cfreturn returnStruct
Or this:
cfset var returnArray = ArrayNew(1)
cfset returnArray [1] = query1
cfset returnArray
Hi, all...
If I'm running two queries inside a function,
how do I return both query values?
Query 1: get_properties
Query 2: get_all_photos
cfreturn get_properties /
cfreturn get_all_photos /
Can there be two cfreturn's?
or, perhaps, cfreturn get_properties, get_all_photos /
???
Rick
put 'em in a struct and return the struct.
cfset var myStruct = structNew() /
cfset var query1 = /
cfset var query2 = /
cfquery name=query1 ...
/cfquery
cfquery name=query2 ...
/cfquery
cfset myStruct.q1 = query1 /
cfset myStruct.q2 = query2 /
cfreturn myStruct /
On Wed, Oct 29, 2008 at
Thanks, Charlie... makes sense.
I guess I could also just run two functions within each cfcase, as well...
Rick
Charlie Griefer wrote:
put 'em in a struct and return the struct.
cfset var myStruct = structNew() /
cfset var query1 = /
cfset var query2 = /
cfquery name=query1 ...
I've got a bit of an issue with the site code (more or less a content
management system) that I've been adding to over the past several years.
The core of my code is a CFC that contains all of my SQL operations in
separate functions. I went with this approach for a number of reasons: it
pulls
It's worked very well, but
there's a problem -- when the site initially loads, it takes forever (well,
about 30 seconds). I'm assuming that this is because the SQL CFC has grown
to almost 4,000 lines of code.
But that's only when the app first loads. And I think your application
variables
Right now, I'm giving serious thought to breaking the SQL CFC up into
multiple separate CFC's (one for each primary area of functionality);
i.e. one CFC for the content management section, one for logging, one
for user management/login/etc., etc. which would leave me with about
10 separate
Larry,
Awesome. Thanx.
Do you know if the Poseidon UML Community version will export an XMI 1.1
file?
~G~
If not any recommendations for a OSS and/or Free UML App?
From what I understand Brian developed the app using Poseidon UML. So yes I
assume it would work.
As for UML reccomendations,
as an extra helper i would say if you are migrating from procedural to OO i
would suggest MG, as it is fantastic and forces you down an OO route.
i havent done too much research on the others but when i was deciding, i posted
a message on this forum and was told that MG is def more OO than
All fine point there Gerald, thank you. I've looked at Illudium in the
past and plan on doing so again for this project. Right now though I'm
trying to map out all my classes in UML to make sure that I have it
together conceptually, then move to the actual coding part. The
database already exists
Larry,
Awesome. Thanx.
Do you know if the Poseidon UML Community version will export an XMI 1.1
file?
~G~
If not any recommendations for a OSS and/or Free UML App?
On Fri, Oct 24, 2008 at 4:19 PM, Larry Lyons [EMAIL PROTECTED] wrote:
All fine point there Gerald, thank you. I've looked at
Hi, all... still trying to get a handle on using CFC's.
Here's an update method I wrote and I'd like to know
what can be changed to make it better. Such as,
why not use the form scope in the query? And, why
not just use the application scope for the dsn, instead
of converting it to the
be put on someone's do-not-hire list because they are
sticklers for things such as this. ;^)
Mike
-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 9:10 AM
To: cf-talk
Subject: How can this CFC be improved?
Hi, all... still trying to get
you need to
store the product_id for the lifetime of the component's instance.)
mike
-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 9:10 AM
To: cf-talk
Subject: How can this CFC be improved?
Hi, all... still trying to get a handle
instantiating a CFC as an object. I assume you
are not because if you did that, you'd probably pass an object into the
update product.
Here's a way I'd re-write your function to make it more abstract:
cffunction name = update_product displayname = update_product hint
= Update specified product output
-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 10:10 AM
To: cf-talk
Subject: How can this CFC be improved?
Hi, all... still trying to get a handle on using CFC's.
Here's an update method I wrote and I'd like to know
what can
for things such as this. ;^)
Mike
-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 9:10 AM
To: cf-talk
Subject: How can this CFC be improved?
Hi, all... still trying to get a handle on using CFC's.
Here's an update method I wrote
the lifetime of the component's instance
Such as, if the variable is going to be used in other methods
before returning data to the calling page?
Dawson, Michael wrote:
Couple others suggestions...
You need to VAR your query:
In your cffunction tag right after the cfargument tag, add:
But by referring to the form directly, your CFC already knows about the
outside. I am just learning about CFCs and OO myself, but I thought the
point of them was to make them independent of what was going on the
outside, and to just pass them the information that they needed regardless
instantiating a CFC as an object. I assume you
are not because if you did that, you'd probably pass an object into the
update product.
Here's a way I'd re-write your function to make it more abstract:
cffunction name = update_product displayname = update_product hint
= Update specified product
10:15 AM
To: cf-talk
Subject: Re: How can this CFC be improved?
Thanks for the feedback, Mike.
Even though it works, it is not a normal practice for the guts of a
component to know what is going on outside.
What's the difference, ultimately, in referring to the form variables in
cfset
Correct.
-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 10:19 AM
To: cf-talk
Subject: Re: How can this CFC be improved?
the lifetime of the component's instance
Such as, if the variable is going to be used in other methods
I think I'm beginning to understand your reasoning.
It's just taking some time for me to get to the best practices of CFC
usage.
Trying to get anything to work at first keeps my projects moving, while
beginning to employ different coding techniques. I'm basically trying to
learn by writing code
Good...maybe I'll catch on before the next decade rolls around...
Jake Churchill wrote:
Right!.
Your call (if you are using the form scope) would look like this:
object.update_product(argumentCollection=form);
or
object.update_product(duplicate(form));
Same thing if you are looking at
the select_featured_products function is not of
type query.
How should I modify this CFC (or the call) to work with or without query
values?
Thanks,
Rick
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get
Using CFCs as function collections like you are doing is the easy part.
Wait till you start creating a true OO backend. I'm working on my first
right now and I thought I was really good at CFCs until I started
this... No pain no gain though, right?
Rick Faircloth wrote:
Good...maybe I'll
. Then I get this error from CF:
The value returned from the select_featured_products function is not of
type query.
How should I modify this CFC (or the call) to work with or without query
values?
Thanks,
Rick
if you are actually instantiating a CFC as an object. I assume you
are not because if you did that, you'd probably pass an object into the
update product.
Here's a way I'd re-write your function to make it more abstract:
cffunction name = update_product displayname = update_product hint
featured_products /
/cffunction
The problem I'm running into happens if there are no featured products
and the query is empty. Then I get this error from CF:
The value returned from the select_featured_products function is not of
type query.
How should I modify this CFC (or the call) to work
(rather than referring to outside
scopes from within the CFC), you potentially worry less about having to
refactor those CFCs. What if in the future, you're not using form
variables, but you change to URL variables? The way you have it set up now,
you have to make changes to the CFC. if you pass
No pain no gain though, right?
As long as whatever is causing the pain doesn't kill you! :o)
Rick
Using CFCs as function collections like you are doing is the easy part.
Wait till you start creating a true OO backend. I'm working on my first
right now and I thought I was really good
but, but, but... I thought I saw CFC examples where the cfreturn variable
didn't match the query name. (It didn't make much sense, but then, again,
not a lot of the CFC stuff does, right now)
The change made it work, however.
Now I know. The cfreturn variable has to match the query name
within the CFC), you potentially worry less about having to
refactor those CFCs. What if in the future, you're not using form
variables, but you change to URL variables? The way you have it set up now,
you have to make changes to the CFC. if you pass all of the variables in
explicitly, it doesn't
, the function above doesn't need the 'howMany' variable.
you can simply cfreturn myQuery.recordcount /. just trying to illustrate
the use of variable names for you.
also (and this might have been said already), in the interest of keeping the
CFC black-boxed... the datasource name should be passed
Rick Faircloth wrote:
Now I know. The cfreturn variable has to match the query name.
Well, no. It has to match what you want to return. Sure there are lots
of examples where the return does not match the query name because the
query is not what is necessarily returned. But if your function
), in the interest of keeping the
CFC black-boxed... the datasource name should be passed in (as opposed to
referencing the application scope from within the CFC).
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release
Got it. Thanks, Ian.
Rick
Ian Skinner wrote:
Rick Faircloth wrote:
Now I know. The cfreturn variable has to match the query name.
Well, no. It has to match what you want to return. Sure there are lots
of examples where the return does not match the query name because the
All fine point there Gerald, thank you. I've looked at Illudium in the
past and plan on doing so again for this project. Right now though I'm
trying to map out all my classes in UML to make sure that I have it
together conceptually, then move to the actual coding part. The
database already exists
601 - 700 of 4677 matches
Mail list logo