Call cfscript inside cfc - its possible?
Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All)# What's wrong? Cheers MD ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219277 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Call cfscript inside cfc - its possible?
You should be able to use any CF function inside a CFC. I think though that you might have it flipped around. Are you trying to use a custom function, which you have created, inside cfscript? If so, then as long as you've defined the function and instantiated it, you should be able to call it from anywhere on the page. !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Michel Deloux [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:41 PM To: CF-Talk Subject: Call cfscript inside cfc - its possible? Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All )# . What's wrong? Cheers MD ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219278 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Call cfscript inside cfc - its possible?
You don't have implicit access to the request's 'variables' scope inside a CFC instance. You'll need to move the UDF into a scope where the CFC internals can reference (request, application, etc.). Though I wouldn't recommend doing it that way. A better route would be to put your UDF in a 'utilities' CFC, and then use that CFC in both your current CFC and in your normal page processing. Better encapsulation that way. cheers, barneyb On 9/26/05, Michel Deloux [EMAIL PROTECTED] wrote: Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All)# What's wrong? Cheers MD -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219279 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Call cfscript inside cfc - its possible?
On 9/26/05, Michel Deloux [EMAIL PROTECTED] wrote: Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All)# What's wrong? There's really no such thing as a cfscript-only tag. In your case, using a cfset will handle the job: cfif arguments.UserField is not cfset myCleanedValue = REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All) / /cfif Be sure to propertly var scope the myCleanedValue, but that'll get you going. Regards, Dave. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219280 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Call cfscript inside cfc - its possible?
i do one of two things... http://www.revolutionwebdesign.com/blog/index.cfm?mode=entryentry=F198C61E-A5EF-DAA0-5EC6F1AB9C7357F7 or for the link impaired... http://www.antiwrap.com/?724 or, what i do, is refactor the udf, into a new component or function of the cfc im using, and then i have it to use as a cfc anyway :) tw On 9/26/05, Andy Matthews [EMAIL PROTECTED] wrote: You should be able to use any CF function inside a CFC. I think though that you might have it flipped around. Are you trying to use a custom function, which you have created, inside cfscript? If so, then as long as you've defined the function and instantiated it, you should be able to call it from anywhere on the page. !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Michel Deloux [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:41 PM To: CF-Talk Subject: Call cfscript inside cfc - its possible? Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All )# . What's wrong? Cheers MD ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219281 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Call cfscript inside cfc - its possible?
Thanks all. Works fine now. Do you know how? Simple. Raymond Camden answers for us: http://ray.camdenfamily.com/index.cfm?mode=entryentry=395FCD72-D363-A830-680B85D89C078C0A After create an utility cfc and insert: cfcomponent output=false cfset init() cffunction name=init access=public cfreturn this /cffunction cfscript function blablabla(path) /cfscript /cfcomponent and so on ...bingo! Now you can call all UDF inside utility with cfinvoke. Thanx Ray and all folks. Cheers MD 2005/9/26, Tony [EMAIL PROTECTED]: i do one of two things... http://www.revolutionwebdesign.com/blog/index.cfm?mode=entryentry=F198C61E-A5EF-DAA0-5EC6F1AB9C7357F7 or for the link impaired... http://www.antiwrap.com/?724 or, what i do, is refactor the udf, into a new component or function of the cfc im using, and then i have it to use as a cfc anyway :) tw On 9/26/05, Andy Matthews [EMAIL PROTECTED] wrote: You should be able to use any CF function inside a CFC. I think though that you might have it flipped around. Are you trying to use a custom function, which you have created, inside cfscript? If so, then as long as you've defined the function and instantiated it, you should be able to call it from anywhere on the page. !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Michel Deloux [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:41 PM To: CF-Talk Subject: Call cfscript inside cfc - its possible? Hi all It's possible to call cfscript functions(application.cfm's living) inside cfc component? I'm calling this function PrepareSearch and CF returns an error: Variable PrepareSearch is undefined. The error occurred in D:\Inetpub\wwwroot\ghost\components\qryGhost.cfc: line 40 38 :CFIF arguments.UserField is not 39 : 40 : #REReplaceNoCase(PrepareSearch(#arguments.UserField#,user),;,',All )# . What's wrong? Cheers MD ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219305 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54