Re: Is this acceptable or reasonable CFC usage?

2009-01-07 Thread Scott Stewart
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

Re: Is this acceptable or reasonable CFC usage?

2009-01-07 Thread Ian Skinner
' 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

RE: Is this acceptable or reasonable CFC usage?

2009-01-07 Thread Rick Faircloth
. 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

RE: Is this acceptable or reasonable CFC usage?

2009-01-07 Thread Rick Faircloth
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

Re: Is this acceptable or reasonable CFC usage?

2009-01-07 Thread Jason Fisher
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?

RE: Return JSON from a CFC

2009-01-06 Thread Joe
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

Re: Return JSON from a CFC

2009-01-06 Thread Cutter (CFRelated)
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

Re: Return JSON from a CFC

2009-01-06 Thread Mike Hughes
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

Re: Return JSON from a CFC

2009-01-06 Thread Raymond Camden
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

Trying to find a CFC

2009-01-06 Thread Bobby Tomato
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?

Can I invoke a cfc with a loop?

2009-01-06 Thread Torrent Girl
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Barney Boisvert
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Torrent Girl
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 ~|

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Torrent Girl
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Barney Boisvert
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Torrent Girl
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Barney Boisvert
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

Re: Can I invoke a cfc with a loop?

2009-01-06 Thread Torrent Girl
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

Return JSON from a CFC

2009-01-05 Thread Joe
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

RE: Return JSON from a CFC

2009-01-05 Thread brad
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

Re: Return JSON from a CFC

2009-01-05 Thread Judah McAuley
-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

Re: Return JSON from a CFC

2009-01-05 Thread Raymond Camden
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

RE: Return JSON from a CFC

2009-01-05 Thread Joe
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

Re: Return JSON from a CFC

2009-01-05 Thread Raymond Camden
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

Coldfusion 8 Unable to invoke CFC always added to error message

2008-12-10 Thread Ahmed El-Khuffash
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

Error invoking CFC

2008-11-20 Thread Jeff F
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

Re: Error invoking CFC

2008-11-20 Thread Jeff F
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

Re: Error invoking CFC

2008-11-20 Thread Gerald Guido
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

Re: Error invoking CFC

2008-11-20 Thread Jeff F
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

Re: Error invoking CFC

2008-11-20 Thread Gerald Guido
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

Re: Error invoking CFC

2008-11-20 Thread Jeff F
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

Re: Error invoking CFC

2008-11-20 Thread Jeff F
: 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

RE: CFC and Form Variables Question

2008-11-02 Thread Adrian Lynch
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

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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

RE: CFC and Form Variables Question

2008-11-02 Thread Adrian Lynch
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

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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)

Re: CFC and Form Variables Question

2008-11-02 Thread Azadi Saryev
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

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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

RE: CFC and Form Variables Question

2008-11-02 Thread William Seiter
::-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

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
, 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

Re: CFC and Form Variables Question

2008-11-02 Thread Dave Watts
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 -

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-02 Thread Dave Watts
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

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-02 Thread Dominic Watson
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,

Re: CFC and Form Variables Question

2008-11-02 Thread Rick Faircloth
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

CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-01 Thread Dominic Watson
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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-01 Thread Dominic Watson
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

Re: CFC and Form Variables Question

2008-11-01 Thread Dominic Watson
= 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

Re: CFC and Form Variables Question

2008-11-01 Thread Mike Chabot
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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
' 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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-01 Thread Dominic Watson
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

Re: CFC and Form Variables Question

2008-11-01 Thread Dominic Watson
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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-01 Thread Mike Chabot
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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

Re: CFC and Form Variables Question

2008-11-01 Thread Mike Chabot
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

Re: CFC and Form Variables Question

2008-11-01 Thread Rick Faircloth
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

RE: cfreturn 2 query values from CFC?

2008-10-30 Thread Adrian Lynch
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

Re: cfreturn 2 query values from CFC?

2008-10-30 Thread Rick Faircloth
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

cfreturn 2 query values from CFC?

2008-10-29 Thread Rick Faircloth
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

Re: cfreturn 2 query values from CFC?

2008-10-29 Thread Charlie Griefer
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

Re: cfreturn 2 query values from CFC?

2008-10-29 Thread Rick Faircloth
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 ...

Help me understand CFC performance

2008-10-26 Thread Pete Ruckelshaus
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

Re: Help me understand CFC performance

2008-10-26 Thread Will Tomlinson
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

Re: Help me understand CFC performance

2008-10-26 Thread s. isaac dealey
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

Re: basic cfc/oo design question

2008-10-25 Thread Larry Lyons
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,

Re: basic cfc/oo design question

2008-10-24 Thread Richard White
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

Re: basic cfc/oo design question

2008-10-24 Thread Larry Lyons
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

Re: basic cfc/oo design question

2008-10-24 Thread Gerald Guido
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

How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
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

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
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

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
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

RE: How can this CFC be improved?

2008-10-22 Thread Jim Davis
-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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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:

Re: How can this CFC be improved?

2008-10-22 Thread Rob Parkhill
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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
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

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

How to avoid is not of type query error using CFC?

2008-10-22 Thread Rick Faircloth
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

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Charlie Griefer
. 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

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Jake Churchill
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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
(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

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Rick Faircloth
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

Re: How can this CFC be improved?

2008-10-22 Thread Charlie Griefer
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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Charlie Griefer
, 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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Ian Skinner
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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Rick Faircloth
), 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

Re: How to avoid is not of type query error using CFC?

2008-10-22 Thread Rick Faircloth
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

Re: basic cfc/oo design question

2008-10-22 Thread Judah McAuley
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

<    2   3   4   5   6   7   8   9   10   11   >