Re: Cannot access session variables in a cfc

2015-01-29 Thread Scott Stewart

Some of the dangers to this approach include:  the amount of memory
allocated to the JVM. If you stuff alot of data into the Application scope,
it persists in the JVM allocated memory and it's not available to the rest
of the system/application.

You really can't change data in the Application scope without having to
reload it.

I generally use the Application scope for application wide CFC
instantiation, the and not actual application wide data.

Just my $.02

sas

On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com
wrote:


 For what it's worth, the approach of storing a global data item in the
 application scope seems to be legit according to the documentation. Here's
 what it said in the CF10 doc:

 Application variables are a convenient place to store information that all
 pages of your application might need, no matter which client is running
 that application. Using application variables, an application could, for
 example, initialize itself when the first user accesses any page of that
 application. This information can then remain available indefinitely,
 thereby avoiding the overhead of repeated initialization.

 Because the data stored in application variables is available to all pages
 of an application, and remains available until a specific period of
 inactivity passes or the ColdFusion server shuts down, application
 variables are convenient for application-global, persistent data.

 However, because all clients running an application see the same set of
 application variables, these variables are not appropriate for
 client-specific or session-specific information. To target variables for
 specific clients, use client or session variables.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360042
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-29 Thread John Pullam

For what it's worth, the approach of storing a global data item in the 
application scope seems to be legit according to the documentation. Here's what 
it said in the CF10 doc:

Application variables are a convenient place to store information that all 
pages of your application might need, no matter which client is running that 
application. Using application variables, an application could, for example, 
initialize itself when the first user accesses any page of that application. 
This information can then remain available indefinitely, thereby avoiding the 
overhead of repeated initialization.

Because the data stored in application variables is available to all pages of 
an application, and remains available until a specific period of inactivity 
passes or the ColdFusion server shuts down, application variables are 
convenient for application-global, persistent data.

However, because all clients running an application see the same set of 
application variables, these variables are not appropriate for client-specific 
or session-specific information. To target variables for specific clients, use 
client or session variables. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360041
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-29 Thread Scott Stewart

+1

On Thu, Jan 29, 2015 at 12:53 PM, Russ Michaels r...@michaels.me.uk wrote:


 I'll add for the sake of brevity, please don't put application wide cfcs in
 session scope, as a hosting provider I have seen this kill a server. 5000
 users = 5000 instances of the cfc.

 In most cases using a mapping solves the issues you have with cf not
 finding the cfc.


 On Thu, Jan 29, 2015 at 17:00 PM, Scott Stewart webmas...@sstwebworks.com
 
 wrote:


 Some of the dangers to this approach include:  the amount of memory
 allocated to the JVM. If you stuff alot of data into the Application scope,
 it persists in the JVM allocated memory and it's not available to the rest
 of the system/application.

 You really can't change data in the Application scope without having to
 reload it.

 I generally use the Application scope for application wide CFC
 instantiation, the and not actual application wide data.

 Just my $.02

 sas

 On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com
 javascript:;
 wrote:

 
  For what it's worth, the approach of storing a global data item in the
  application scope seems to be legit according to the documentation.
 Here's
  what it said in the CF10 doc:
 
  Application variables are a convenient place to store information that
 all
  pages of your application might need, no matter which client is running
  that application. Using application variables, an application could, for
  example, initialize itself when the first user accesses any page of that
  application. This information can then remain available indefinitely,
  thereby avoiding the overhead of repeated initialization.
 
  Because the data stored in application variables is available to all
 pages
  of an application, and remains available until a specific period of
  inactivity passes or the ColdFusion server shuts down, application
  variables are convenient for application-global, persistent data.
 
  However, because all clients running an application see the same set of
  application variables, these variables are not appropriate for
  client-specific or session-specific information. To target variables for
  specific clients, use client or session variables.
 
 



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360044
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-29 Thread Russ Michaels

I'll add for the sake of brevity, please don't put application wide cfcs in
session scope, as a hosting provider I have seen this kill a server. 5000
users = 5000 instances of the cfc.

In most cases using a mapping solves the issues you have with cf not
finding the cfc.


On Thu, Jan 29, 2015 at 17:00 PM, Scott Stewart webmas...@sstwebworks.com
wrote:


Some of the dangers to this approach include:  the amount of memory
allocated to the JVM. If you stuff alot of data into the Application scope,
it persists in the JVM allocated memory and it's not available to the rest
of the system/application.

You really can't change data in the Application scope without having to
reload it.

I generally use the Application scope for application wide CFC
instantiation, the and not actual application wide data.

Just my $.02

sas

On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com
javascript:;
wrote:


 For what it's worth, the approach of storing a global data item in the
 application scope seems to be legit according to the documentation. Here's
 what it said in the CF10 doc:

 Application variables are a convenient place to store information that all
 pages of your application might need, no matter which client is running
 that application. Using application variables, an application could, for
 example, initialize itself when the first user accesses any page of that
 application. This information can then remain available indefinitely,
 thereby avoiding the overhead of repeated initialization.

 Because the data stored in application variables is available to all pages
 of an application, and remains available until a specific period of
 inactivity passes or the ColdFusion server shuts down, application
 variables are convenient for application-global, persistent data.

 However, because all clients running an application see the same set of
 application variables, these variables are not appropriate for
 client-specific or session-specific information. To target variables for
 specific clients, use client or session variables.





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360043
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

Were you using relative paths to the CFCs.  That could become hairy if you
move things around. 

I'll generally define a CFC path variable in the application.cfm then use
that everywhere.  Never had a problem.  Of course, this assumes all the
CFC's are in the same location. 

Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360023
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread William Seiter

Can you give us some code examples of how it 'used' to be setup?

Where was the CFC saved.
Where was the CFC called.
How was it called.
Etc.

Not that fixing the actual problem will set you suddenly into best
practices, but it will fix your current headache and then you can follow up
with BP later when the fires are out.

Thanks,
William


--
William Seiter


-Original Message-
From: John Pullam [mailto:jpul...@mcleansystems.com] 
Sent: Wednesday, January 28, 2015 8:57 AM
To: cf-talk
Subject: Re: Cannot access session variables in a cfc


I know this isn't ideal, but it is a live application and the decision to
move the cfc's outside of the doc root was taken because CF was having
trouble finding them (for no obvious reason). Code that has worked since CF7
started breaking.

So we moved them and this problem began. 

I am looking for a quick solution for now, knowing that I need to develop a
better one.

I'm wondering about putting the variable in the Application scope? Do the
cfc's have access to that? 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360024
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam

You will need to pass your session variables as a parameter in order to use
them in the CFC, this is best practices anyways.

The difficulty is that there a lot of cfc calls and some of them are in bind 
expressions so the chance of making errors is high. That's why I am so anxious 
to find one that doesn't make me change a lot of programming. Long term I will 
opt for a better solution.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360025
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann

On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote:


  try adding an Application.cfc in the root physical directory

 I don't that that will work. It would still be a separate application pool,
 and I think you need the CFID and CFTOKEN cookies to have session vars.




Did a simple test on CF10 and CF8 and this does seem to work.  The only
identifier for an application is the application name that I'm aware of, so
I would guess the first Application.cfc to be called would be the one to
initialize the application.  Subsequent calls would set the session and
application timeouts, thus setting them the same would be a good idea.

That being said, Dean's proxy suggestion is probably best, since you would
probably want the code to run from either application.cfc.

I thought the directory structure might be like this. The proxy would still
work, but would probably just need a cfmapping to the app root so the
/cfc/application.cfc could find the /app/applicationproxy.cfc.

/cfc
/app
/app/application.cfc


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360035
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann

@Dean,

Looked into this a bit further on CF10.

root
- Application.cfc
- ApplicationProxy.cfc (extends Application)
- cfc-folder
- - Application.cfc (extends ApplicationProxy)
- - myCFC.cfc

This does not work without the cfc/application.cfc having
extends=root.ApplicationProxy, where 'root' is a CF mapping.

As you said, CF will search from the application root downward on the file
system. Since there is an Application.cfc in the cfc folder, it would start
there and not find the ApplicationProxy in the directory above.

This would work if the actual root directory was cfusion/wwwroot, or maybe
if both application.cfc had the same applicationName and the
ApplicationProxy was used/cached in /root app somehow before /root/cfc was
initialized.

If you use a CF mapping the proxy is really not even necessary, as this
does work.

/cfc/application.cfc
-
cfcomponent extends=root.application

Cheers,
Byron








On Wed, Jan 28, 2015 at 3:44 PM, Dean Lawrence dean...@gmail.com wrote:


 Byron, the ApplicationProxy.cfc needs to be in the root directory along
 with the main Application.cfc. When you extend a CFC, CF will first look in
 the same directory to see if that CFC exist. If it doesn't CF will start
 looking for the CFC from the application root down. So by simply adding
 extends=ApplicationProxy to the Application.cfc within the /cfc
 directory, CF will find the ApplicationProxy.cfc in the root, which in turn
 finds the Application.cfc in the root. No mappings are needed.

 T


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360039
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence

Byron, the ApplicationProxy.cfc needs to be in the root directory along
with the main Application.cfc. When you extend a CFC, CF will first look in
the same directory to see if that CFC exist. If it doesn't CF will start
looking for the CFC from the application root down. So by simply adding
extends=ApplicationProxy to the Application.cfc within the /cfc
directory, CF will find the ApplicationProxy.cfc in the root, which in turn
finds the Application.cfc in the root. No mappings are needed.

On Wed, Jan 28, 2015 at 3:21 PM, Byron Mann byronos...@gmail.com wrote:


 On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com
 wrote:

 
   try adding an Application.cfc in the root physical directory
 
  I don't that that will work. It would still be a separate application
 pool,
  and I think you need the CFID and CFTOKEN cookies to have session vars.
 



 Did a simple test on CF10 and CF8 and this does seem to work.  The only
 identifier for an application is the application name that I'm aware of, so
 I would guess the first Application.cfc to be called would be the one to
 initialize the application.  Subsequent calls would set the session and
 application timeouts, thus setting them the same would be a good idea.

 That being said, Dean's proxy suggestion is probably best, since you would
 probably want the code to run from either application.cfc.

 I thought the directory structure might be like this. The proxy would still
 work, but would probably just need a cfmapping to the app root so the
 /cfc/application.cfc could find the /app/applicationproxy.cfc.

 /cfc
 /app
 /app/application.cfc


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360036
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence

Hmm, that's odd as I use that setup on numerous sites and I never have to
map the applicationproxy. I am currently using it on both ACF 10 and 11,
but I started using this around 8 or 9 and haven't changed it for new
version. I don't believe that you could use the root.(dot) notation in 8 or
9, which if I remember correctly, predicated the use of the proxy. Every
site is also housed in completely different directories, nowhere near the
cfusion/wwwroot directory, so I am not sure why it is didn't work for you
as well. Anyway, thanks for the additional info regarding cutting out the
proxy step.

On Wed, Jan 28, 2015 at 4:54 PM, Byron Mann byronos...@gmail.com wrote:


 @Dean,

 Looked into this a bit further on CF10.

 root
 - Application.cfc
 - ApplicationProxy.cfc (extends Application)
 - cfc-folder
 - - Application.cfc (extends ApplicationProxy)
 - - myCFC.cfc

 This does not work without the cfc/application.cfc having
 extends=root.ApplicationProxy, where 'root' is a CF mapping.

 As you said, CF will search from the application root downward on the file
 system. Since there is an Application.cfc in the cfc folder, it would start
 there and not find the ApplicationProxy in the directory above.

 This would work if the actual root directory was cfusion/wwwroot, or maybe
 if both application.cfc had the same applicationName and the
 ApplicationProxy was used/cached in /root app somehow before /root/cfc was
 initialized.

 If you use a CF mapping the proxy is really not even necessary, as this
 does work.

 /cfc/application.cfc
 -
 cfcomponent extends=root.application

 Cheers,
 Byron








 On Wed, Jan 28, 2015 at 3:44 PM, Dean Lawrence dean...@gmail.com wrote:

 
  Byron, the ApplicationProxy.cfc needs to be in the root directory along
  with the main Application.cfc. When you extend a CFC, CF will first look
 in
  the same directory to see if that CFC exist. If it doesn't CF will start
  looking for the CFC from the application root down. So by simply adding
  extends=ApplicationProxy to the Application.cfc within the /cfc
  directory, CF will find the ApplicationProxy.cfc in the root, which in
 turn
  finds the Application.cfc in the root. No mappings are needed.
 
  T


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360040
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Cannot access session variables in a cfc

2015-01-28 Thread John Pullam

My app is running in a CF10 system and since I moved my cfc's out of the 
document root, they are losing access to the session variables. It seems that 
they work for around a day and then can no longer be found. I initialize them 
in my application.cfm to a value and I can still cfdump them in a regular web 
page, but the cfc fails with the error Element XXX is undefined in SESSION.

Is this normal behaviour? If it is, then what is the alternative method of 
passing a variable into the cfc (other than making it a parameter when 
calling)? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360014
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

 What other method than session variables can I use to pass a common
variable that won't require me to include it as a parameter of every calling
routine?

Since you've moved your CFCs out of the application I cannot think of any
other method beside passing them all as arguments. 

Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360018
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

If you moved your cfc's above the application.cfc (or application.cfm) file,
the session variables will not be accessible. Session and application vars
are accessible from the application file down. 


Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360015
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam

If you moved your cfc's above the application.cfc (or application.cfm) file,
the session variables will not be accessible. Session and application vars
are accessible from the application file down. 

That's what we did.

What other method than session variables can I use to pass a common variable 
that won't require me to include it as a parameter of every calling routine? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360016
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Steve 'Cutter' Blades

You shouldn't, as it breaks encapsulation. Any outside variables you 
would need inside a cfc should be passed into the cfc, either as part of 
your object initialization, or directly into a specific method.

Cutter

On 1/28/2015 10:25 AM, John Pullam wrote:
 If you moved your cfc's above the application.cfc (or application.cfm) file,
 the session variables will not be accessible. Session and application vars
 are accessible from the application file down.

 That's what we did.

 What other method than session variables can I use to pass a common variable 
 that won't require me to include it as a parameter of every calling routine?



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360017
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam

Thanx. That's what I think I will do for the time being.

It is hard for me to come up with all the symptoms that we started seeing on 
the cfc's now and I don't think I could do justice to any explanation of those 
issues. It seemed to me that it was all quite normal stuff. All pages and cfc's 
were in the same doc root. And I have had issues with cfc locations on my test 
system because it gets confused with localhost and virtual directories, so 
getting the cfc's into a separate folder had a certain appeal.

I'm planning to do a big refresh on the app over the summer and this is going 
to be addressed then. In the meantime, I have my fingers crossed than an 
application scoped variable will get us through.

Thanx again. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360027
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

 You shouldn't, as it breaks encapsulation

Honestly, I too think you should reconsider moving the CFC out of the web
root.  

Maybe if you moved them out then created objects from them in the
application.cfc, then you may be able to use session vars, as I think the
objects would still be in the application. 


Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360020
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread William Seiter

You will need to pass your session variables as a parameter in order to use
them in the CFC, this is best practices anyways.

Good news, however, is that you can send them as a complete struct, you
don't necessarily need to have them send all separately.

cfargument name=sSession type=struct required=yes /

Hope this helps,
William

--
William Seiter

-Original Message-
From: John Pullam [mailto:jpul...@mcleansystems.com] 
Sent: Wednesday, January 28, 2015 8:08 AM
To: cf-talk
Subject: Cannot access session variables in a cfc


My app is running in a CF10 system and since I moved my cfc's out of the
document root, they are losing access to the session variables. It seems
that they work for around a day and then can no longer be found. I
initialize them in my application.cfm to a value and I can still cfdump them
in a regular web page, but the cfc fails with the error Element XXX is
undefined in SESSION.

Is this normal behaviour? If it is, then what is the alternative method of
passing a variable into the cfc (other than making it a parameter when
calling)? 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360022
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam

I know this isn't ideal, but it is a live application and the decision to move 
the cfc's outside of the doc root was taken because CF was having trouble 
finding them (for no obvious reason). Code that has worked since CF7 started 
breaking.

So we moved them and this problem began. 

I am looking for a quick solution for now, knowing that I need to develop a 
better one.

I'm wondering about putting the variable in the Application scope? Do the cfc's 
have access to that? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360021
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

Well, I'd hate to do this, but you could define an application.myvar type
variable and put all the variables you need to pass in that as a structure
or list, then send that variable in your arguments.  That would get to one
variable ... but then you're still going to need to deconstruct it before
you could use them in the CFC's.

Personally I think you should put your CFC's back and fix the problem that's
making you move them in the first place.  

Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360026
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann

While I agree it isn't a good practice to make use of scope variables in a
CFC, try adding an Application.cfc in the root physical directory of your
CFCs and use the same application name and session and app timeouts.

I think this would work in older versions, but not too sure about more
recent versions.

On Wed, Jan 28, 2015 at 11:08 AM, John Pullam jpul...@mcleansystems.com
wrote:


 My app is running in a CF10 system and since I moved my cfc's out of the
 document root, they are losing access to the session variables. It seems
 that they work for around a day and then can no longer be found. I
 initialize them in my application.cfm to a value and I can still cfdump
 them in a regular web page, but the cfc fails with the error Element XXX
 is undefined in SESSION.

 Is this normal behaviour? If it is, then what is the alternative method of
 passing a variable into the cfc (other than making it a parameter when
 calling)?

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360030
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison

 try adding an Application.cfc in the root physical directory

I don't that that will work. It would still be a separate application pool,
and I think you need the CFID and CFTOKEN cookies to have session vars. 

Robert Harrison
Full Stack Developer
AIMG
rharri...@aimg.com
Main Office: 704-321-1234  ext.118
Direct Line: 516-302-4345
www.aimg.com


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360031
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence

You could also extend the main application.cfc. You can't do this directly
if the cfc's are in a sub-directory though. If that is the case, you could
use a proxy, I do this all the time. Here would be the structure.

root
- Application.cfc
- ApplicationProxy.cfc (extends Application)
- cfc-folder
- - Application.cfc (extends ApplicationProxy)
- - myCFC.cfc

You will probably want to also call super.onApplicationStart() from within
the cfc folder Application.cfc's onApplicationStart() method. The same
would hold true for onSessionStart(), you would want to call
super.OnSessionStart(). This ensures that all the main application and
session vars get initialized properly.

On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote:


  try adding an Application.cfc in the root physical directory

 I don't that that will work. It would still be a separate application pool,
 and I think you need the CFID and CFTOKEN cookies to have session vars.

 Robert Harrison
 Full Stack Developer
 AIMG
 rharri...@aimg.com
 Main Office: 704-321-1234  ext.118
 Direct Line: 516-302-4345
 www.aimg.com


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360032
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Cannot access session variables in a cfc

2015-01-28 Thread Steve 'Cutter' Blades

John,

There are some pretty significant advancements to CFCs since CF 7, 
especially around scoping. You definitely want to look at the difference 
up the version chain.

Cutter

On 1/28/2015 12:02 PM, John Pullam wrote:
 Thanx. That's what I think I will do for the time being.

 It is hard for me to come up with all the symptoms that we started seeing on 
 the cfc's now and I don't think I could do justice to any explanation of 
 those issues. It seemed to me that it was all quite normal stuff. All pages 
 and cfc's were in the same doc root. And I have had issues with cfc locations 
 on my test system because it gets confused with localhost and virtual 
 directories, so getting the cfc's into a separate folder had a certain appeal.

 I'm planning to do a big refresh on the app over the summer and this is going 
 to be addressed then. In the meantime, I have my fingers crossed than an 
 application scoped variable will get us through.

 Thanx again.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360034
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


best way to invoke cfc

2014-07-21 Thread Matthew Smith

I was using cfinvoke but someone here said it was better to do this:
cfset variables.temp = cfcs.qry

How do I set the method and pass parameters?

Thanks.

-- 
Regards,
chedder is bedder


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358932
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: best way to invoke cfc

2014-07-21 Thread Andrew Scott

easy

RTFM

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html



Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+:  http://plus.google.com/113032480415921517411



On Tue, Jul 22, 2014 at 5:14 AM, Matthew Smith chedders...@gmail.com
wrote:


 I was using cfinvoke but someone here said it was better to do this:
 cfset variables.temp = cfcs.qry

 How do I set the method and pass parameters?

 Thanks.

 --
 Regards,
 chedder is bedder


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358935
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: best way to invoke cfc

2014-07-21 Thread Matthew Smith

This uses the cfinvoke tag.  I am looking to use cfset variables.temp


On Mon, Jul 21, 2014 at 2:20 PM, Andrew Scott andr...@andyscott.id.au
wrote:


 easy

 RTFM


 http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html



 Regards,
 Andrew Scott
 WebSite: http://www.andyscott.id.au/
 Google+:  http://plus.google.com/113032480415921517411



 On Tue, Jul 22, 2014 at 5:14 AM, Matthew Smith chedders...@gmail.com
 wrote:

 
  I was using cfinvoke but someone here said it was better to do this:
  cfset variables.temp = cfcs.qry
 
  How do I set the method and pass parameters?
 
  Thanks.
 
  --
  Regards,
  chedder is bedder
 
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358941
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: best way to invoke cfc

2014-07-21 Thread Andrew Scott

You must be joking right!!

What your asking is the most basic features of ColdFusion that IS well
documented in the Adobe ColdFusion documentation, if you're too lazy to go
and read that to get such a basic answer, that's not our problem.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+:  http://plus.google.com/113032480415921517411



On Tue, Jul 22, 2014 at 9:03 AM, Matthew Smith chedders...@gmail.com
wrote:


 This uses the cfinvoke tag.  I am looking to use cfset variables.temp


 On Mon, Jul 21, 2014 at 2:20 PM, Andrew Scott andr...@andyscott.id.au
 wrote:

 
  easy
 
  RTFM
 
 
 
 http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html
 
 
 
  Regards,
  Andrew Scott
  WebSite: http://www.andyscott.id.au/
  Google+:  http://plus.google.com/113032480415921517411
 
 
 
  On Tue, Jul 22, 2014 at 5:14 AM, Matthew Smith chedders...@gmail.com
  wrote:
 
  
   I was using cfinvoke but someone here said it was better to do this:
   cfset variables.temp = cfcs.qry
  
   How do I set the method and pass parameters?
  
   Thanks.
  
   --
   Regards,
   chedder is bedder
  
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358955
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: best way to invoke cfc

2014-07-21 Thread Andrew Scott

But I will give you a hint, read up on CreateObject() and if your on a
supported release then you could also look at the import and new operand
and as your are already familiar with cfinvoke, maybe reading what other
attributes and features it offers couldn't hurt either.

But seriously, these basic questions are all in the Documentation. If not
Google your question and you will find hundreds of examples and tutorials
on this subject.


Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+:  http://plus.google.com/113032480415921517411



On Tue, Jul 22, 2014 at 3:37 PM, Andrew Scott andr...@andyscott.id.au
wrote:

 You must be joking right!!

 What your asking is the most basic features of ColdFusion that IS well
 documented in the Adobe ColdFusion documentation, if you're too lazy to go
 and read that to get such a basic answer, that's not our problem.

 Regards,
 Andrew Scott
 WebSite: http://www.andyscott.id.au/
 Google+:  http://plus.google.com/113032480415921517411



 On Tue, Jul 22, 2014 at 9:03 AM, Matthew Smith chedders...@gmail.com
 wrote:


 This uses the cfinvoke tag.  I am looking to use cfset variables.temp


 On Mon, Jul 21, 2014 at 2:20 PM, Andrew Scott andr...@andyscott.id.au
 wrote:

 
  easy
 
  RTFM
 
 
 
 http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html
 
 
 
  Regards,
  Andrew Scott
  WebSite: http://www.andyscott.id.au/
  Google+:  http://plus.google.com/113032480415921517411
 
 
 
  On Tue, Jul 22, 2014 at 5:14 AM, Matthew Smith chedders...@gmail.com
  wrote:
 
  
   I was using cfinvoke but someone here said it was better to do this:
   cfset variables.temp = cfcs.qry
  
   How do I set the method and pass parameters?
  
   Thanks.
  
   --
   Regards,
   chedder is bedder
  
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358956
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


CFC Not Returning JSON properly from an array

2014-03-14 Thread Rixon Reed

I have a CFC that I'm trying to return JSON data in a web service.=20
If I do a dump before I return the code to the calling program, the JSON is=
fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\=
n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio=
\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\=
t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\=
n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\=
n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t=
\\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category=
\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor=
y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo=
lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\=
n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\=
t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t=
\\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t=
\\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\=
/category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\=
\\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro=
ot\]

What am I doing wrong? Thanks in advance. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357935
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC Not Returning JSON properly from an array

2014-03-14 Thread Carl Von Stetten

Are you doing SerializeJSON() in your CFC method, AND have 
returntype=JSON on the function definition?  If so, it is double 
serializing the data.  Remove the SerializeJSON() call and allow the 
function to automatically do the serialization.

HTH,
-Carl V.

On 3/14/2014 12:26 PM, Rixon Reed wrote:
 I have a CFC that I'm trying to return JSON data in a web service.=20
 If I do a dump before I return the code to the calling program, the JSON is=
 fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\=
 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio=
 \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\=
 t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\=
 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=
 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\=
 n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
 t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t=
 \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category=
 \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor=
 y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo=
 lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\=
 n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\=
 t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t=
 \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t=
 \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\=
 /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=
 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\=
 \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro=
 ot\]

 What am I doing wrong? Thanks in advance.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357936
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC Not Returning JSON properly from an array

2014-03-14 Thread Byron Mann

The default for the return format for a remote cffunction call is WDDX.
Sounds like inside your CFC you are serializing the return value first.

So something like return serializeJson(myValue);

If the return string in this case is JSON, then your remote call to the
CFC should include a returnformat=plain, to return the string as is.

Byron Mann
Lead Engineer  Architect
HostMySite.com


On Fri, Mar 14, 2014 at 3:26 PM, Rixon Reed ri...@photoeye.com wrote:


 I have a CFC that I'm trying to return JSON data in a web service.=20
 If I do a dump before I return the code to the calling program, the JSON
 is=
 fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\=

 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio=
 \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\=

 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\=

 n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t=

 \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category=

 \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor=

 y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo=

 lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\=

 n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\=

 t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t=

 \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t=

 \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\=

 /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\=

 \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro=
 ot\]

 What am I doing wrong? Thanks in advance.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357937
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC Not Returning JSON properly from an array

2014-03-14 Thread Steve 'Cutter' Blades

on your ajax call, did you add returnformat: 'json' as one of your post 
data arguments? If you don't specify this, then the remote method will 
return WDDX by default.

Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer

http://cutterscrossing.com


Co-Author Learning Ext JS 3.2 Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book

The best way to predict the future is to help create it

On 3/14/2014 3:21 PM, Byron Mann wrote:
 The default for the return format for a remote cffunction call is WDDX.
 Sounds like inside your CFC you are serializing the return value first.

 So something like return serializeJson(myValue);

 If the return string in this case is JSON, then your remote call to the
 CFC should include a returnformat=plain, to return the string as is.

 Byron Mann
 Lead Engineer  Architect
 HostMySite.com


 On Fri, Mar 14, 2014 at 3:26 PM, Rixon Reed ri...@photoeye.com wrote:

 I have a CFC that I'm trying to return JSON data in a web service.=20
 If I do a dump before I return the code to the calling program, the JSON
 is=
 fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\=

 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio=
 \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\=

 n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\=

 t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\=

 n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t=

 \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category=

 \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor=

 y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo=

 lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\=

 n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\=

 t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t=

 \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t=

 \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\=

 /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\=

 t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\=

 \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro=
 ot\]

 What am I doing wrong? Thanks in advance.


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357938
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Rick Faircloth

Hmmm...

I tried using the specialIDList.push(specialID) approach, and I get the
correct
output in console.log,  [ 27, 28, 26 ], but I also get the error in
Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.

I also tried using specialIDList = specialID.join(', ') and I still get the
same
output in console.log, [ 27, 28, 26 ], but I also get the same error
in Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.

So, the cfc method doesn't understand speciaIDList when it's sent in the
form
above, even when I specify the argument as array type.

Suggestions on what to do now? Something else on the client side with
jQuery/JS
or something on the method side with CF?

Thanks for any feedback!

Rick






On Wed, Jan 15, 2014 at 9:20 PM, Raymond Camden raymondcam...@gmail.comwrote:


 On Wed, Jan 15, 2014 at 5:38 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
 
 
  It shows [ 27, 28, 26 ] in the console.
 
  I guess I can just pass that through and have a cfargument type of list
  and parse those ID's with a cfloop to assign them to individual
  cfarguments.
 
  Or does a cfargument type of list handle the ID's without having to
  break down the list into individual arguments?
 
 
 Not exactly. You can't pass complex variables like that via HTTP. It has to
 be serialized first. I believe jQuery will do that for you- but I'd
 probably do it myself - ie, somearray.join(,).




 
  On Wed, Jan 15, 2014 at 6:00 PM, Raymond Camden raymondcam...@gmail.com
  wrote:


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357444
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Raymond Camden

On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth r...@whitestonemedia.comwrote:


 Hmmm...

 I tried using the specialIDList.push(specialID) approach, and I get the
 correct
 output in console.log,  [ 27, 28, 26 ], but I also get the error in
 Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.





 I also tried using specialIDList = specialID.join(', ') and I still get the
 same
 output in console.log, [ 27, 28, 26 ], but I also get the same error
 in Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.


Ok, so you passed specialidlist, right? Can you show us your latest code?



 So, the cfc method doesn't understand speciaIDList when it's sent in the
 form
 above, even when I specify the argument as array type.


Remember, we are sending the data over the wire as a string. So your
argument should be string.

But for now, let's see your client side code again please.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357445
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Rick Faircloth

Here's the client-side code:

$(document).ready(function() {

  $('#newsletter_preview_button').click(function() {

  var emailNewsletterGreeting = $('#email_newsletter_greeting').val();

  var specialIDList = [];

  $('.special_title_checkbox:checked').each(function() {

  var specialID = $(this).attr('id').split('_').pop();
  specialIDList = specialID.join(', ');

  });

  console.log(specialIDList);

  values =  { emailNewsletterGreeting: emailNewsletterGreeting,
  specialIDList:  specialIDList }


  $.ajax({  cache:false,
  type:  'post',

'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
  data:  values,
  success:function(response) {

  alert('Success!');

  }
  });

  });

});

On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden raymondcam...@gmail.comwrote:


 On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
  Hmmm...
 
  I tried using the specialIDList.push(specialID) approach, and I get the
  correct
  output in console.log,  [ 27, 28, 26 ], but I also get the error in
  Firebug,
  500 Element SPECIALIDLIST is undefined in ARGUMENTS.
 



 
  I also tried using specialIDList = specialID.join(', ') and I still get
 the
  same
  output in console.log, [ 27, 28, 26 ], but I also get the same
 error
  in Firebug,
  500 Element SPECIALIDLIST is undefined in ARGUMENTS.
 

 Ok, so you passed specialidlist, right? Can you show us your latest code?


 
  So, the cfc method doesn't understand speciaIDList when it's sent in the
  form
  above, even when I specify the argument as array type.
 

 Remember, we are sending the data over the wire as a string. So your
 argument should be string.

 But for now, let's see your client side code again please.


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357446
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Steve Milburn

Inside your .each loop you want to push specialID to your array like so:
specialIDList.push (specialID). Afterwards when you are preparing your
values object to be sent to the server you do specialIDList.join to put
them into a string.
On Jan 16, 2014 12:32 PM, Rick Faircloth r...@whitestonemedia.com wrote:


 Here's the client-side code:

 $(document).ready(function() {

   $('#newsletter_preview_button').click(function() {

   var emailNewsletterGreeting = $('#email_newsletter_greeting').val();

   var specialIDList = [];

   $('.special_title_checkbox:checked').each(function() {

   var specialID = $(this).attr('id').split('_').pop();
   specialIDList = specialID.join(', ');

   });

   console.log(specialIDList);

   values =  { emailNewsletterGreeting: emailNewsletterGreeting,
   specialIDList:  specialIDList }


   $.ajax({  cache:false,
   type:  'post',


 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
   data:  values,
   success:function(response) {

   alert('Success!');

   }
   });

   });

 });

 On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden raymondcam...@gmail.com
 wrote:

 
  On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth 
 r...@whitestonemedia.com
  wrote:
 
  
   Hmmm...
  
   I tried using the specialIDList.push(specialID) approach, and I get the
   correct
   output in console.log,  [ 27, 28, 26 ], but I also get the error
 in
   Firebug,
   500 Element SPECIALIDLIST is undefined in ARGUMENTS.
  
 
 
 
  
   I also tried using specialIDList = specialID.join(', ') and I still get
  the
   same
   output in console.log, [ 27, 28, 26 ], but I also get the same
  error
   in Firebug,
   500 Element SPECIALIDLIST is undefined in ARGUMENTS.
  
 
  Ok, so you passed specialidlist, right? Can you show us your latest code?
 
 
  
   So, the cfc method doesn't understand speciaIDList when it's sent in
 the
   form
   above, even when I specify the argument as array type.
  
 
  Remember, we are sending the data over the wire as a string. So your
  argument should be string.
 
  But for now, let's see your client side code again please.
 
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357447
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Rick Faircloth

Hi, Steve...

I just gave that a try, but still get an error in Firebug:
500 Element SPECIALIDLIST is undefined in ARGUMENTS

Also, in the console, I still get what appears to be the same when I use
console.log(specialIDLlist):
[ 27, 28, 26 ].

Perhaps something is missing on the cfc method side? Here's that code:

cffunction name   = mProcessEmailNewsletterForm
  displayName=  mProcessEmailNewsletterForm
  hint  =  Processes Email Newsletter Form
  output  =  true
  access =  remote
  returnType= struct 

  cfargument name = emailNewsletterGreeting type = string required =
no /
  cfargument name = specialIDList  type = string required
= no /

  cfset emailNewsletterStruct = structNew() /

  cfset emailNewsletterStruct.EMAILNEWSLETTERGREETING =
'#arguments.emailNewsletterGreeting#'
/
  cfset emailNewsletterStruct.SPECIALIDLIST = '#arguments.specialIDList#'
/

  cfreturn emailNewsletterStruct /

/cffunction


???




On Thu, Jan 16, 2014 at 12:50 PM, Steve Milburn scmilb...@gmail.com wrote:


 Inside your .each loop you want to push specialID to your array like so:
 specialIDList.push (specialID). Afterwards when you are preparing your
 values object to be sent to the server you do specialIDList.join to put
 them into a string.
 On Jan 16, 2014 12:32 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
  Here's the client-side code:
 
  $(document).ready(function() {
 
$('#newsletter_preview_button').click(function() {
 
var emailNewsletterGreeting = $('#email_newsletter_greeting').val();
 
var specialIDList = [];
 
$('.special_title_checkbox:checked').each(function() {
 
var specialID = $(this).attr('id').split('_').pop();
specialIDList = specialID.join(', ');
 
});
 
console.log(specialIDList);
 
values =  { emailNewsletterGreeting:
 emailNewsletterGreeting,
specialIDList:  specialIDList }
 
 
$.ajax({  cache:false,
type:  'post',
 
 
 
 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
data:  values,
success:function(response) {
 
alert('Success!');
 
}
});
 
});
 
  });
 
  On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden 
 raymondcam...@gmail.com
  wrote:
 
  
   On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth 
  r...@whitestonemedia.com
   wrote:
  
   
Hmmm...
   
I tried using the specialIDList.push(specialID) approach, and I get
 the
correct
output in console.log,  [ 27, 28, 26 ], but I also get the
 error
  in
Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.
   
  
  
  
   
I also tried using specialIDList = specialID.join(', ') and I still
 get
   the
same
output in console.log, [ 27, 28, 26 ], but I also get the same
   error
in Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.
   
  
   Ok, so you passed specialidlist, right? Can you show us your latest
 code?
  
  
   
So, the cfc method doesn't understand speciaIDList when it's sent in
  the
form
above, even when I specify the argument as array type.
   
  
   Remember, we are sending the data over the wire as a string. So your
   argument should be string.
  
   But for now, let's see your client side code again please.
  
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357448
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Rick Faircloth

Hold the horses!

I changed the join from:

specialIDList.join();

to:

var specialIDList = specialIDList.join();

and it worked!

I think the var, specialIDList, was not available to the ajax function
since it was being recreated
in the .each loop.

So, now do I have to loop over the multiple variables in specialIDList on
the server side with CF
in order to break the string into individual arguments?




On Thu, Jan 16, 2014 at 2:07 PM, Rick Faircloth r...@whitestonemedia.comwrote:

 Hi, Steve...

 I just gave that a try, but still get an error in Firebug:
 500 Element SPECIALIDLIST is undefined in ARGUMENTS

 Also, in the console, I still get what appears to be the same when I use
 console.log(specialIDLlist):
 [ 27, 28, 26 ].

 Perhaps something is missing on the cfc method side? Here's that code:

 cffunction name   = mProcessEmailNewsletterForm
   displayName=  mProcessEmailNewsletterForm
   hint  =  Processes Email Newsletter Form
   output  =  true
   access =  remote
   returnType= struct 

   cfargument name = emailNewsletterGreeting type = string required =
 no /
   cfargument name = specialIDList  type = string required
 = no /

   cfset emailNewsletterStruct = structNew() /

   cfset emailNewsletterStruct.EMAILNEWSLETTERGREETING = 
 '#arguments.emailNewsletterGreeting#'
 /
   cfset emailNewsletterStruct.SPECIALIDLIST = '#arguments.specialIDList#'
 /

   cfreturn emailNewsletterStruct /

 /cffunction


 ???




 On Thu, Jan 16, 2014 at 12:50 PM, Steve Milburn scmilb...@gmail.comwrote:


 Inside your .each loop you want to push specialID to your array like so:
 specialIDList.push (specialID). Afterwards when you are preparing your
 values object to be sent to the server you do specialIDList.join to put
 them into a string.
 On Jan 16, 2014 12:32 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
  Here's the client-side code:
 
  $(document).ready(function() {
 
$('#newsletter_preview_button').click(function() {
 
var emailNewsletterGreeting = $('#email_newsletter_greeting').val();
 
var specialIDList = [];
 
$('.special_title_checkbox:checked').each(function() {
 
var specialID = $(this).attr('id').split('_').pop();
specialIDList = specialID.join(', ');
 
});
 
console.log(specialIDList);
 
values =  { emailNewsletterGreeting:
 emailNewsletterGreeting,
specialIDList:  specialIDList
 }
 
 
$.ajax({  cache:false,
type:  'post',
 
 
 
 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
data:  values,
success:function(response) {
 
alert('Success!');
 
}
});
 
});
 
  });
 
  On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden 
 raymondcam...@gmail.com
  wrote:
 
  
   On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth 
  r...@whitestonemedia.com
   wrote:
  
   
Hmmm...
   
I tried using the specialIDList.push(specialID) approach, and I get
 the
correct
output in console.log,  [ 27, 28, 26 ], but I also get the
 error
  in
Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.
   
  
  
  
   
I also tried using specialIDList = specialID.join(', ') and I still
 get
   the
same
output in console.log, [ 27, 28, 26 ], but I also get the same
   error
in Firebug,
500 Element SPECIALIDLIST is undefined in ARGUMENTS.
   
  
   Ok, so you passed specialidlist, right? Can you show us your latest
 code?
  
  
   
So, the cfc method doesn't understand speciaIDList when it's sent in
  the
form
above, even when I specify the argument as array type.
   
  
   Remember, we are sending the data over the wire as a string. So your
   argument should be string.
  
   But for now, let's see your client side code again please.
  
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357449
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Steve Milburn

You cant break the string into individual arguments. It will be one
argument that contains a string with comma separated values, which can be
easily handled with CFs list functions. I'm not sure what you want to do
with them in your CFC, but you can loop through the values like so:

cfloop list=#arguments.specialIDList# index=local.loopIndex
  ... here you have access to each value individually to work with
/cfloop


On Thu, Jan 16, 2014 at 2:11 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 Hold the horses!

 I changed the join from:

 specialIDList.join();

 to:

 var specialIDList = specialIDList.join();

 and it worked!

 I think the var, specialIDList, was not available to the ajax function
 since it was being recreated
 in the .each loop.

 So, now do I have to loop over the multiple variables in specialIDList on
 the server side with CF
 in order to break the string into individual arguments?




 On Thu, Jan 16, 2014 at 2:07 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

  Hi, Steve...
 
  I just gave that a try, but still get an error in Firebug:
  500 Element SPECIALIDLIST is undefined in ARGUMENTS
 
  Also, in the console, I still get what appears to be the same when I use
  console.log(specialIDLlist):
  [ 27, 28, 26 ].
 
  Perhaps something is missing on the cfc method side? Here's that code:
 
  cffunction name   = mProcessEmailNewsletterForm
displayName=  mProcessEmailNewsletterForm
hint  =  Processes Email Newsletter Form
output  =  true
access =  remote
returnType= struct 
 
cfargument name = emailNewsletterGreeting type = string required =
  no /
cfargument name = specialIDList  type = string
 required
  = no /
 
cfset emailNewsletterStruct = structNew() /
 
cfset emailNewsletterStruct.EMAILNEWSLETTERGREETING =
 '#arguments.emailNewsletterGreeting#'
  /
cfset emailNewsletterStruct.SPECIALIDLIST =
 '#arguments.specialIDList#'
  /
 
cfreturn emailNewsletterStruct /
 
  /cffunction
 
 
  ???
 
 
 
 
  On Thu, Jan 16, 2014 at 12:50 PM, Steve Milburn scmilb...@gmail.com
 wrote:
 
 
  Inside your .each loop you want to push specialID to your array like so:
  specialIDList.push (specialID). Afterwards when you are preparing your
  values object to be sent to the server you do specialIDList.join to put
  them into a string.
  On Jan 16, 2014 12:32 PM, Rick Faircloth r...@whitestonemedia.com
  wrote:
 
  
   Here's the client-side code:
  
   $(document).ready(function() {
  
 $('#newsletter_preview_button').click(function() {
  
 var emailNewsletterGreeting = $('#email_newsletter_greeting').val();
  
 var specialIDList = [];
  
 $('.special_title_checkbox:checked').each(function() {
  
 var specialID = $(this).attr('id').split('_').pop();
 specialIDList = specialID.join(', ');
  
 });
  
 console.log(specialIDList);
  
 values =  { emailNewsletterGreeting:
  emailNewsletterGreeting,
 specialIDList:  specialIDList
  }
  
  
 $.ajax({  cache:false,
 type:  'post',
  
  
  
 
 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
 data:  values,
 success:function(response) {
  
 alert('Success!');
  
 }
 });
  
 });
  
   });
  
   On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden 
  raymondcam...@gmail.com
   wrote:
  
   
On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth 
   r...@whitestonemedia.com
wrote:
   

 Hmmm...

 I tried using the specialIDList.push(specialID) approach, and I
 get
  the
 correct
 output in console.log,  [ 27, 28, 26 ], but I also get the
  error
   in
 Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.

   
   
   

 I also tried using specialIDList = specialID.join(', ') and I
 still
  get
the
 same
 output in console.log, [ 27, 28, 26 ], but I also get the
 same
error
 in Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.

   
Ok, so you passed specialidlist, right? Can you show us your latest
  code?
   
   

 So, the cfc method doesn't understand speciaIDList when it's sent
 in
   the
 form
 above, even when I specify the argument as array type.

   
Remember, we are sending the data over the wire as a string. So your
argument should be string.
   
But for now, let's see your client side code again please.
   
   
   
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357450
Subscription: http

Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-16 Thread Steve 'Cutter' Blades

You could just run your form through this tiny plugin, prior to 
submitting your ajax request

https://github.com/cutterbl/CFQueryToForm/blob/master/resources/scripts/jquery/jquery.serializejson-0.2.js

Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer

http://cutterscrossing.com


Co-Author Learning Ext JS 3.2 Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book

The best way to predict the future is to help create it

On 1/16/2014 1:22 PM, Steve Milburn wrote:
 You cant break the string into individual arguments. It will be one
 argument that contains a string with comma separated values, which can be
 easily handled with CFs list functions. I'm not sure what you want to do
 with them in your CFC, but you can loop through the values like so:

 cfloop list=#arguments.specialIDList# index=local.loopIndex
... here you have access to each value individually to work with
 /cfloop


 On Thu, Jan 16, 2014 at 2:11 PM, Rick Faircloth 
 r...@whitestonemedia.comwrote:

 Hold the horses!

 I changed the join from:

 specialIDList.join();

 to:

 var specialIDList = specialIDList.join();

 and it worked!

 I think the var, specialIDList, was not available to the ajax function
 since it was being recreated
 in the .each loop.

 So, now do I have to loop over the multiple variables in specialIDList on
 the server side with CF
 in order to break the string into individual arguments?




 On Thu, Jan 16, 2014 at 2:07 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:
 Hi, Steve...

 I just gave that a try, but still get an error in Firebug:
 500 Element SPECIALIDLIST is undefined in ARGUMENTS

 Also, in the console, I still get what appears to be the same when I use
 console.log(specialIDLlist):
 [ 27, 28, 26 ].

 Perhaps something is missing on the cfc method side? Here's that code:

 cffunction name   = mProcessEmailNewsletterForm
displayName=  mProcessEmailNewsletterForm
hint  =  Processes Email Newsletter Form
output  =  true
access =  remote
returnType= struct 

cfargument name = emailNewsletterGreeting type = string required =
 no /
cfargument name = specialIDList  type = string
 required
 = no /

cfset emailNewsletterStruct = structNew() /

cfset emailNewsletterStruct.EMAILNEWSLETTERGREETING =
 '#arguments.emailNewsletterGreeting#'
 /
cfset emailNewsletterStruct.SPECIALIDLIST =
 '#arguments.specialIDList#'
 /

cfreturn emailNewsletterStruct /

 /cffunction


 ???




 On Thu, Jan 16, 2014 at 12:50 PM, Steve Milburn scmilb...@gmail.com
 wrote:

 Inside your .each loop you want to push specialID to your array like so:
 specialIDList.push (specialID). Afterwards when you are preparing your
 values object to be sent to the server you do specialIDList.join to put
 them into a string.
 On Jan 16, 2014 12:32 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 Here's the client-side code:

 $(document).ready(function() {

$('#newsletter_preview_button').click(function() {

var emailNewsletterGreeting = $('#email_newsletter_greeting').val();

var specialIDList = [];

$('.special_title_checkbox:checked').each(function() {

var specialID = $(this).attr('id').split('_').pop();
specialIDList = specialID.join(', ');

});

console.log(specialIDList);

values =  { emailNewsletterGreeting:
 emailNewsletterGreeting,
specialIDList:  specialIDList
 }

$.ajax({  cache:false,
type:  'post',



 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
data:  values,
success:function(response) {

alert('Success!');

}
});

});

 });

 On Thu, Jan 16, 2014 at 11:02 AM, Raymond Camden 
 raymondcam...@gmail.com
 wrote:
 On Thu, Jan 16, 2014 at 9:54 AM, Rick Faircloth 
 r...@whitestonemedia.com
 wrote:
 Hmmm...

 I tried using the specialIDList.push(specialID) approach, and I
 get
 the
 correct
 output in console.log,  [ 27, 28, 26 ], but I also get the
 error
 in
 Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.



 I also tried using specialIDList = specialID.join(', ') and I
 still
 get
 the
 same
 output in console.log, [ 27, 28, 26 ], but I also get the
 same
 error
 in Firebug,
 500 Element SPECIALIDLIST is undefined in ARGUMENTS.

 Ok, so you passed specialidlist, right? Can you show us your latest
 code?

 So, the cfc method doesn't understand speciaIDList when it's sent
 in
 the
 form
 above, even when I specify the argument as array type.

 Remember, we are sending the data over the wire as a string. So your
 argument should be string.

 But for now, let's see your

How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Rick Faircloth

Hi, all...

I've approached this problem from every direction I can think of and with
reference to many, many websites, but I still can put together an answer.

I have this HTML in a form:

  cfoutput query = qGetSpecials

  div class=special_title_container
  span class=title_checkbox_span
  input id=special_id_#special_id# class=special_title_checkbox
value=#special_title# type=checkbox name=special_title
  /span
  span class=special_title_span#special_title#/span
  /div

  /cfoutput

Which is output into this:

input id=special_id_26 class=special_title_checkbox value=First
Special type=checkbox name=special_title
input id=special_id_27 class=special_title_checkbox value=Second
Special type=checkbox name=special_title
input id=special_id_28 class=special_title_checkbox value=Third
Special type=checkbox name=special_title

This jQuery processing the inputs:

$(document).ready(function() {

  $('#newsletter_preview_button').click(function() {

  var specialTitleID = $('.special_title_checkbox:checked');

  $('.special_title_checkbox:checked').each(function(index,value) {

  var specialTitleID = $(this).attr('id').split('_').pop();
  var specialTitleID = 'specialTitle_'+specialTitleID;

  alert(specialTitleID); --- [ this alerts the three input values, 26, 27,
28, individually when form is submitted ]

  });

  values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
  specialTitleID: specialTitleID}

  (Followed by AJAX code...)

And this cfc method:

  cffunction name   = mProcessEmailNewsletterForm
  displayName=  mProcessEmailNewsletterForm
hint  =  Processes Email Newsletter Form
  output  =  true
  access =  remote
  returnType=  struct 

  cfargument name = emailNewsletterGreeting type = string
  required = no /
  cfargument name = specialTitleID type =
string  required
= no /

  cfset emailNewsletterStruct = structNew() /

  cfset emailNewsletterStruct.email_newsletter_greeting =
'#arguments.email_newsletter_greeting#'
/
  cfset emailNewsletterStruct.specialTitleID   =
'#arguments.specialTitleID#'
/

cfreturn emailNewsletterStruct /

 /cffunction

But, the cffunction above doesn't know what to do with the value,
specialTitleID, when it's received.
Or, rather, I don't know how to change it in the jQuery code or the
cffunction code so that each
specialTitleID can be separted into individual cfarguments.

I've tried specifying cfargument name=specialTitleID as type=array,
type=list, type=string,
but I get a JS error in Firebug no matter what I try. I'm sure it's simple,
I just haven't handled
a multi-valued variable going via AJAX to a cfc method before. (or that I
remember...).

Suggestions, anyone?

Thanks,

Rick

-- 
--
Ninety percent of the politicians give the other ten percent a bad
reputation.  Henry Kissinger


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357429
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Raymond Camden

Why didn't yo post the AJAX code? Isn't that crucial for getting the values
to your CFC? We need to see that.


On Wed, Jan 15, 2014 at 2:56 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 Hi, all...

 I've approached this problem from every direction I can think of and with
 reference to many, many websites, but I still can put together an answer.

 I have this HTML in a form:

   cfoutput query = qGetSpecials

   div class=special_title_container
   span class=title_checkbox_span
   input id=special_id_#special_id# class=special_title_checkbox
 value=#special_title# type=checkbox name=special_title
   /span
   span class=special_title_span#special_title#/span
   /div

   /cfoutput

 Which is output into this:

 input id=special_id_26 class=special_title_checkbox value=First
 Special type=checkbox name=special_title
 input id=special_id_27 class=special_title_checkbox value=Second
 Special type=checkbox name=special_title
 input id=special_id_28 class=special_title_checkbox value=Third
 Special type=checkbox name=special_title

 This jQuery processing the inputs:

 $(document).ready(function() {

   $('#newsletter_preview_button').click(function() {

   var specialTitleID = $('.special_title_checkbox:checked');

   $('.special_title_checkbox:checked').each(function(index,value) {

   var specialTitleID = $(this).attr('id').split('_').pop();
   var specialTitleID = 'specialTitle_'+specialTitleID;

   alert(specialTitleID); --- [ this alerts the three input values, 26, 27,
 28, individually when form is submitted ]

   });

   values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
   specialTitleID: specialTitleID}

   (Followed by AJAX code...)




 --

 --
 Ninety percent of the politicians give the other ten percent a bad
 reputation.  Henry Kissinger


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357430
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Robert Harrison

If the value isn't changing after the page is rendered you may be able to use 
document.write java script to write the variable to a CF variable that you can 
pass to the CFC.  I've done that before and it works fine, so long as the 
variable doesn't change after the page is rendered.

Robert Harrison 
Director of Interactive Services

Austin  Williams
Advertising I Branding I Digital I Direct  
125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
T 631.231.6600 X 119   F 631.434.7022   
http://www.austin-williams.com

Blog:  http://www.austin-williams.com/blog
Twitter:  http://www.twitter.com/austin_williams 


-Original Message-
From: Rick Faircloth [mailto:r...@whitestonemedia.com] 
Sent: Wednesday, January 15, 2014 3:57 PM
To: cf-talk
Subject: How do I pass this jQuery variable as arguments to a cfc method?


Hi, all...

I've approached this problem from every direction I can think of and with 
reference to many, many websites, but I still can put together an answer.

I have this HTML in a form:

  cfoutput query = qGetSpecials

  div class=special_title_container
  span class=title_checkbox_span
  input id=special_id_#special_id# class=special_title_checkbox
value=#special_title# type=checkbox name=special_title
  /span
  span class=special_title_span#special_title#/span
  /div

  /cfoutput

Which is output into this:

input id=special_id_26 class=special_title_checkbox value=First Special 
type=checkbox name=special_title input id=special_id_27 
class=special_title_checkbox value=Second Special type=checkbox 
name=special_title input id=special_id_28 class=special_title_checkbox 
value=Third Special type=checkbox name=special_title

This jQuery processing the inputs:

$(document).ready(function() {

  $('#newsletter_preview_button').click(function() {

  var specialTitleID = $('.special_title_checkbox:checked');

  $('.special_title_checkbox:checked').each(function(index,value) {

  var specialTitleID = $(this).attr('id').split('_').pop();
  var specialTitleID = 'specialTitle_'+specialTitleID;

  alert(specialTitleID); --- [ this alerts the three input values, 26, 27, 28, 
individually when form is submitted ]

  });

  values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
  specialTitleID: specialTitleID}

  (Followed by AJAX code...)

And this cfc method:

  cffunction name   = mProcessEmailNewsletterForm
  displayName=  mProcessEmailNewsletterForm
hint  =  Processes Email Newsletter Form
  output  =  true
  access =  remote
  returnType=  struct 

  cfargument name = emailNewsletterGreeting type = string
  required = no /
  cfargument name = specialTitleID type =
string  required
= no /

  cfset emailNewsletterStruct = structNew() /

  cfset emailNewsletterStruct.email_newsletter_greeting =
'#arguments.email_newsletter_greeting#'
/
  cfset emailNewsletterStruct.specialTitleID   =
'#arguments.specialTitleID#'
/

cfreturn emailNewsletterStruct /

 /cffunction

But, the cffunction above doesn't know what to do with the value, 
specialTitleID, when it's received.
Or, rather, I don't know how to change it in the jQuery code or the cffunction 
code so that each specialTitleID can be separted into individual cfarguments.

I've tried specifying cfargument name=specialTitleID as type=array, 
type=list, type=string, but I get a JS error in Firebug no matter what I 
try. I'm sure it's simple, I just haven't handled a multi-valued variable going 
via AJAX to a cfc method before. (or that I remember...).

Suggestions, anyone?

Thanks,

Rick

--
--
Ninety percent of the politicians give the other ten percent a bad 
reputation.  Henry Kissinger




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357431
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Matt Quackenbush

It is **impossible** to use document.write java script (sic) to write the
variable to a CF variable. Cannot be done. Why? Because CF variables are
only available on the server side, and are long gone figments of one's
imagination by the time the HTML/JavaScript/CSS/etc. reaches the client
side (the browser).

You can, however, use JavaScript to write a form field value or to directly
POST/GET to/from a CFC once the page has loaded in the browser.


On Wed, Jan 15, 2014 at 4:17 PM, Robert Harrison rob...@austin-williams.com
 wrote:


 If the value isn't changing after the page is rendered you may be able to
 use document.write java script to write the variable to a CF variable that
 you can pass to the CFC.  I've done that before and it works fine, so long
 as the variable doesn't change after the page is rendered.

 Robert Harrison
 Director of Interactive Services

 Austin  Williams
 Advertising I Branding I Digital I Direct
 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
 T 631.231.6600 X 119   F 631.434.7022
 http://www.austin-williams.com

 Blog:  http://www.austin-williams.com/blog
 Twitter:  http://www.twitter.com/austin_williams


 -Original Message-
 From: Rick Faircloth [mailto:r...@whitestonemedia.com]
 Sent: Wednesday, January 15, 2014 3:57 PM
 To: cf-talk
 Subject: How do I pass this jQuery variable as arguments to a cfc method?


 Hi, all...

 I've approached this problem from every direction I can think of and with
 reference to many, many websites, but I still can put together an answer.

 I have this HTML in a form:

   cfoutput query = qGetSpecials

   div class=special_title_container
   span class=title_checkbox_span
   input id=special_id_#special_id# class=special_title_checkbox
 value=#special_title# type=checkbox name=special_title
   /span
   span class=special_title_span#special_title#/span
   /div

   /cfoutput

 Which is output into this:

 input id=special_id_26 class=special_title_checkbox value=First
 Special type=checkbox name=special_title input id=special_id_27
 class=special_title_checkbox value=Second Special type=checkbox
 name=special_title input id=special_id_28
 class=special_title_checkbox value=Third Special type=checkbox
 name=special_title

 This jQuery processing the inputs:

 $(document).ready(function() {

   $('#newsletter_preview_button').click(function() {

   var specialTitleID = $('.special_title_checkbox:checked');

   $('.special_title_checkbox:checked').each(function(index,value) {

   var specialTitleID = $(this).attr('id').split('_').pop();
   var specialTitleID = 'specialTitle_'+specialTitleID;

   alert(specialTitleID); --- [ this alerts the three input values, 26,
 27, 28, individually when form is submitted ]

   });

   values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
   specialTitleID: specialTitleID}

   (Followed by AJAX code...)

 And this cfc method:

   cffunction name   = mProcessEmailNewsletterForm
   displayName=  mProcessEmailNewsletterForm
 hint  =  Processes Email Newsletter Form
   output  =  true
   access =  remote
   returnType=  struct 

   cfargument name = emailNewsletterGreeting type = string
   required = no /
   cfargument name = specialTitleID type =
 string  required
 = no /

   cfset emailNewsletterStruct = structNew() /

   cfset emailNewsletterStruct.email_newsletter_greeting =
 '#arguments.email_newsletter_greeting#'
 /
   cfset emailNewsletterStruct.specialTitleID   =
 '#arguments.specialTitleID#'
 /

 cfreturn emailNewsletterStruct /

  /cffunction

 But, the cffunction above doesn't know what to do with the value,
 specialTitleID, when it's received.
 Or, rather, I don't know how to change it in the jQuery code or the
 cffunction code so that each specialTitleID can be separted into individual
 cfarguments.

 I've tried specifying cfargument name=specialTitleID as type=array,
 type=list, type=string, but I get a JS error in Firebug no matter what
 I try. I'm sure it's simple, I just haven't handled a multi-valued variable
 going via AJAX to a cfc method before. (or that I remember...).

 Suggestions, anyone?

 Thanks,

 Rick

 --

 --
 Ninety percent of the politicians give the other ten percent a bad
 reputation.  Henry Kissinger




 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357432
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Robert Harrison

 It is **impossible** to document.write... 

 yes, your right.  Sorry about that.  It was the other way... writing CF to JS 
 vars.  My bad!  Doing too much as once. 


Robert Harrison 
Director of Interactive Services

Austin  Williams
Advertising I Branding I Digital I Direct  
125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
T 631.231.6600 X 119   F 631.434.7022   
http://www.austin-williams.com

Blog:  http://www.austin-williams.com/blog
Twitter:  http://www.twitter.com/austin_

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357433
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Jon Clausen

I would set your argument type as a list and then validate,loop and process the 
list in your CFC method.  If so you’ll need to change your each() loop to 
append the variables in to the list and then post the string in your $.post() 
request.

HTH,
Jon




On Jan 15, 2014, at 3:56 PM, Rick Faircloth r...@whitestonemedia.com wrote:

 
 Hi, all...
 
 I've approached this problem from every direction I can think of and with
 reference to many, many websites, but I still can put together an answer.
 
 I have this HTML in a form:
 
  cfoutput query = qGetSpecials
 
  div class=special_title_container
  span class=title_checkbox_span
  input id=special_id_#special_id# class=special_title_checkbox
 value=#special_title# type=checkbox name=special_title
  /span
  span class=special_title_span#special_title#/span
  /div
 
  /cfoutput
 
 Which is output into this:
 
 input id=special_id_26 class=special_title_checkbox value=First
 Special type=checkbox name=special_title
 input id=special_id_27 class=special_title_checkbox value=Second
 Special type=checkbox name=special_title
 input id=special_id_28 class=special_title_checkbox value=Third
 Special type=checkbox name=special_title
 
 This jQuery processing the inputs:
 
 $(document).ready(function() {
 
  $('#newsletter_preview_button').click(function() {
 
  var specialTitleID = $('.special_title_checkbox:checked');
 
  $('.special_title_checkbox:checked').each(function(index,value) {
 
  var specialTitleID = $(this).attr('id').split('_').pop();
  var specialTitleID = 'specialTitle_'+specialTitleID;
 
  alert(specialTitleID); --- [ this alerts the three input values, 26, 27,
 28, individually when form is submitted ]
 
  });
 
  values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
  specialTitleID: specialTitleID}
 
  (Followed by AJAX code...)
 
 And this cfc method:
 
  cffunction name   = mProcessEmailNewsletterForm
  displayName=  mProcessEmailNewsletterForm
 hint  =  Processes Email Newsletter Form
  output  =  true
  access =  remote
  returnType=  struct 
 
  cfargument name = emailNewsletterGreeting type = string
  required = no /
  cfargument name = specialTitleID type =
 string  required
 = no /
 
  cfset emailNewsletterStruct = structNew() /
 
  cfset emailNewsletterStruct.email_newsletter_greeting =
 '#arguments.email_newsletter_greeting#'
 /
  cfset emailNewsletterStruct.specialTitleID   =
 '#arguments.specialTitleID#'
 /
 
 cfreturn emailNewsletterStruct /
 
 /cffunction
 
 But, the cffunction above doesn't know what to do with the value,
 specialTitleID, when it's received.
 Or, rather, I don't know how to change it in the jQuery code or the
 cffunction code so that each
 specialTitleID can be separted into individual cfarguments.
 
 I've tried specifying cfargument name=specialTitleID as type=array,
 type=list, type=string,
 but I get a JS error in Firebug no matter what I try. I'm sure it's simple,
 I just haven't handled
 a multi-valued variable going via AJAX to a cfc method before. (or that I
 remember...).
 
 Suggestions, anyone?
 
 Thanks,
 
 Rick
 
 -- 
 --
 Ninety percent of the politicians give the other ten percent a bad
 reputation.  Henry Kissinger
 
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357434
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Jon Clausen

On a related note, the Postman extension for Chrome is great for testing what 
your remote CFC's are doing with form variables.

 On Jan 15, 2014, at 4:53 PM, Jon Clausen jon_clau...@silowebworks.com wrote:
 
 
 I would set your argument type as a list and then validate,loop and process 
 the list in your CFC method.  If so you’ll need to change your each() loop 
 to append the variables in to the list and then post the string in your 
 $.post() request.
 
 HTH,
 Jon
 
 
 
 
 On Jan 15, 2014, at 3:56 PM, Rick Faircloth r...@whitestonemedia.com wrote:
 
 
 Hi, all...
 
 I've approached this problem from every direction I can think of and with
 reference to many, many websites, but I still can put together an answer.
 
 I have this HTML in a form:
 
 cfoutput query = qGetSpecials
 
 div class=special_title_container
 span class=title_checkbox_span
 input id=special_id_#special_id# class=special_title_checkbox
 value=#special_title# type=checkbox name=special_title
 /span
 span class=special_title_span#special_title#/span
 /div
 
 /cfoutput
 
 Which is output into this:
 
 input id=special_id_26 class=special_title_checkbox value=First
 Special type=checkbox name=special_title
 input id=special_id_27 class=special_title_checkbox value=Second
 Special type=checkbox name=special_title
 input id=special_id_28 class=special_title_checkbox value=Third
 Special type=checkbox name=special_title
 
 This jQuery processing the inputs:
 
 $(document).ready(function() {
 
 $('#newsletter_preview_button').click(function() {
 
 var specialTitleID = $('.special_title_checkbox:checked');
 
 $('.special_title_checkbox:checked').each(function(index,value) {
 
 var specialTitleID = $(this).attr('id').split('_').pop();
 var specialTitleID = 'specialTitle_'+specialTitleID;
 
 alert(specialTitleID); --- [ this alerts the three input values, 26, 27,
 28, individually when form is submitted ]
 
 });
 
 values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
 specialTitleID: specialTitleID}
 
 (Followed by AJAX code...)
 
 And this cfc method:
 
 cffunction name   = mProcessEmailNewsletterForm
 displayName=  mProcessEmailNewsletterForm
 hint  =  Processes Email Newsletter Form
 output  =  true
 access =  remote
 returnType=  struct 
 
 cfargument name = emailNewsletterGreeting type = string
 required = no /
 cfargument name = specialTitleID type =
 string  required
 = no /
 
 cfset emailNewsletterStruct = structNew() /
 
 cfset emailNewsletterStruct.email_newsletter_greeting =
 '#arguments.email_newsletter_greeting#'
 /
 cfset emailNewsletterStruct.specialTitleID   =
 '#arguments.specialTitleID#'
 /
 
 cfreturn emailNewsletterStruct /
 
 /cffunction
 
 But, the cffunction above doesn't know what to do with the value,
 specialTitleID, when it's received.
 Or, rather, I don't know how to change it in the jQuery code or the
 cffunction code so that each
 specialTitleID can be separted into individual cfarguments.
 
 I've tried specifying cfargument name=specialTitleID as type=array,
 type=list, type=string,
 but I get a JS error in Firebug no matter what I try. I'm sure it's simple,
 I just haven't handled
 a multi-valued variable going via AJAX to a cfc method before. (or that I
 remember...).
 
 Suggestions, anyone?
 
 Thanks,
 
 Rick
 
 -- 
 --
 Ninety percent of the politicians give the other ten percent a bad
 reputation.  Henry Kissinger
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357435
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Raymond Camden

How is that better than the Network tab itself?


On Wed, Jan 15, 2014 at 3:59 PM, Jon Clausen
jon_clau...@silowebworks.comwrote:


 On a related note, the Postman extension for Chrome is great for testing
 what your remote CFC's are doing with form variables.

  On Jan 15, 2014, at 4:53 PM, Jon Clausen jon_clau...@silowebworks.com
 wrote:
 
 
  I would set your argument type as a list and then validate,loop and
 process the list in your CFC method.  If so you’ll need to change your
 each() loop to append the variables in to the list and then post the string
 in your $.post() request.
 
  HTH,
  Jon



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357436
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Rick Faircloth

Hey, Ray, and thanks for the reply...

Here's the ajax part...

$.ajax ({ cache:  false,
  type:'post',
  url:
  'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
  data:values,
  success:  function(result) {

  alert('Success!');

  }


On Wed, Jan 15, 2014 at 4:03 PM, Raymond Camden raymondcam...@gmail.comwrote:


 Why didn't yo post the AJAX code? Isn't that crucial for getting the values
 to your CFC? We need to see that.


 On Wed, Jan 15, 2014 at 2:56 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
  Hi, all...
 
  I've approached this problem from every direction I can think of and with
  reference to many, many websites, but I still can put together an answer.
 
  I have this HTML in a form:
 
cfoutput query = qGetSpecials
 
div class=special_title_container
span class=title_checkbox_span
input id=special_id_#special_id# class=special_title_checkbox
  value=#special_title# type=checkbox name=special_title
/span
span class=special_title_span#special_title#/span
/div
 
/cfoutput
 
  Which is output into this:
 
  input id=special_id_26 class=special_title_checkbox value=First
  Special type=checkbox name=special_title
  input id=special_id_27 class=special_title_checkbox value=Second
  Special type=checkbox name=special_title
  input id=special_id_28 class=special_title_checkbox value=Third
  Special type=checkbox name=special_title
 
  This jQuery processing the inputs:
 
  $(document).ready(function() {
 
$('#newsletter_preview_button').click(function() {
 
var specialTitleID = $('.special_title_checkbox:checked');
 
$('.special_title_checkbox:checked').each(function(index,value) {
 
var specialTitleID = $(this).attr('id').split('_').pop();
var specialTitleID = 'specialTitle_'+specialTitleID;
 
alert(specialTitleID); --- [ this alerts the three input values, 26,
 27,
  28, individually when form is submitted ]
 
});
 
values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
specialTitleID: specialTitleID}
 
(Followed by AJAX code...)
 
 
 
 
  --
 
 
 --
  Ninety percent of the politicians give the other ten percent a bad
  reputation.  Henry Kissinger
 
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357437
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Raymond Camden

So values is this:

  values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
  specialTitleID: specialTitleID}

I see you set specialTitleID. But you had it in loop. You probably wanted
to make that an array. If the values are IDs though you could use an array
and convert it to a list. So assuming you fixed it and specialTitleID was
an array, you could do:

specialTitleList = specialTitleID.join(,);

Not sure where you set emailNewsletterGretting.

You then want to use Chrome Dev Tools and look at the network request and
see how the value is being passed in.


On Wed, Jan 15, 2014 at 4:50 PM, Rick Faircloth r...@whitestonemedia.comwrote:


 Hey, Ray, and thanks for the reply...

 Here's the ajax part...

 $.ajax ({ cache:  false,
   type:'post',
   url:

 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
   data:values,
   success:  function(result) {

   alert('Success!');

   }


 On Wed, Jan 15, 2014 at 4:03 PM, Raymond Camden raymondcam...@gmail.com
 wrote:

 
  Why didn't yo post the AJAX code? Isn't that crucial for getting the
 values
  to your CFC? We need to see that.
 
 
  On Wed, Jan 15, 2014 at 2:56 PM, Rick Faircloth 
 r...@whitestonemedia.com
  wrote:
 
  
   Hi, all...
  
   I've approached this problem from every direction I can think of and
 with
   reference to many, many websites, but I still can put together an
 answer.
  
   I have this HTML in a form:
  
 cfoutput query = qGetSpecials
  
 div class=special_title_container
 span class=title_checkbox_span
 input id=special_id_#special_id# class=special_title_checkbox
   value=#special_title# type=checkbox name=special_title
 /span
 span class=special_title_span#special_title#/span
 /div
  
 /cfoutput
  
   Which is output into this:
  
   input id=special_id_26 class=special_title_checkbox value=First
   Special type=checkbox name=special_title
   input id=special_id_27 class=special_title_checkbox value=Second
   Special type=checkbox name=special_title
   input id=special_id_28 class=special_title_checkbox value=Third
   Special type=checkbox name=special_title
  
   This jQuery processing the inputs:
  
   $(document).ready(function() {
  
 $('#newsletter_preview_button').click(function() {
  
 var specialTitleID = $('.special_title_checkbox:checked');
  
 $('.special_title_checkbox:checked').each(function(index,value) {
  
 var specialTitleID = $(this).attr('id').split('_').pop();
 var specialTitleID = 'specialTitle_'+specialTitleID;
  
 alert(specialTitleID); --- [ this alerts the three input values, 26,
  27,
   28, individually when form is submitted ]
  
 });
  
 values =  {   emailNewsletterGreeting:
 emailNewsletterGreeting,
 specialTitleID: specialTitleID}
  
 (Followed by AJAX code...)
  
  
  
  
   --
  
  
 
 --
   Ninety percent of the politicians give the other ten percent a bad
   reputation.  Henry Kissinger
  
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357438
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Jon Clausen

I like Postman because I can manually test  web services, including HTTP verbs 
and enter form and URL variables against services to test responses and error 
handling in a variety of formats. It also has tabs that parse your return data, 
like the network tab does, but in a better format.  It's better at functional 
testing web services, IMHO, than posting AJAX calls repeatedly in page.



[Note: Typo assistance courtesy of iPhone]

 On Jan 15, 2014, at 5:37 PM, Raymond Camden raymondcam...@gmail.com wrote:
 
 
 How is that better than the Network tab itself?
 
 
 On Wed, Jan 15, 2014 at 3:59 PM, Jon Clausen
 jon_clau...@silowebworks.comwrote:
 
 
 On a related note, the Postman extension for Chrome is great for testing
 what your remote CFC's are doing with form variables.
 
 On Jan 15, 2014, at 4:53 PM, Jon Clausen jon_clau...@silowebworks.com
 wrote:
 
 
 I would set your argument type as a list and then validate,loop and
 process the list in your CFC method.  If so you’ll need to change your
 each() loop to append the variables in to the list and then post the string
 in your $.post() request.
 
 HTH,
 Jon
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357439
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Raymond Camden

Ah - so it lets you do ad hoc testing. That is cool.


On Wed, Jan 15, 2014 at 5:18 PM, Jon Clausen
jon_clau...@silowebworks.comwrote:


 I like Postman because I can manually test  web services, including HTTP
 verbs and enter form and URL variables against services to test responses
 and error handling in a variety of formats. It also has tabs that parse
 your return data, like the network tab does, but in a better format.  It's
 better at functional testing web services, IMHO, than posting AJAX calls
 repeatedly in page.





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357440
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Rick Faircloth

I set emailNewsletterGreeting earlier. It's a value from a single DOM
element,
so no problem with that.

And I was tinkering with code prior to the ajax code, so I was changing
variable
names halting the processing before ajax kicked in.

Your array idea sounds good.

I also tried this:

var specialIDList = [];

$('.special_title_checkbox:checked').each(function(index,value) {

  var specialTitleID = $(this).attr('id').split('_').pop();
  specialIDList.push(specialTitleID);

});

console.log(specialIDList);

and was able to see the list in Firebug.

It shows [ 27, 28, 26 ] in the console.

I guess I can just pass that through and have a cfargument type of list
and parse those ID's with a cfloop to assign them to individual cfarguments.

Or does a cfargument type of list handle the ID's without having to
break down the list into individual arguments?


On Wed, Jan 15, 2014 at 6:00 PM, Raymond Camden raymondcam...@gmail.comwrote:


 So values is this:

   values =  {   emailNewsletterGreeting: emailNewsletterGreeting,
   specialTitleID: specialTitleID}

 I see you set specialTitleID. But you had it in loop. You probably wanted
 to make that an array. If the values are IDs though you could use an array
 and convert it to a list. So assuming you fixed it and specialTitleID was
 an array, you could do:

 specialTitleList = specialTitleID.join(,);

 Not sure where you set emailNewsletterGretting.

 You then want to use Chrome Dev Tools and look at the network request and
 see how the value is being passed in.


 On Wed, Jan 15, 2014 at 4:50 PM, Rick Faircloth r...@whitestonemedia.com
 wrote:

 
  Hey, Ray, and thanks for the reply...
 
  Here's the ajax part...
 
  $.ajax ({ cache:  false,
type:'post',
url:
 
 
 'email-newsletter.cfc?method=mProcessEmailNewsletterFormreturnFormat=json',
data:values,
success:  function(result) {
 
alert('Success!');
 
}
 
 
  On Wed, Jan 15, 2014 at 4:03 PM, Raymond Camden raymondcam...@gmail.com
  wrote:
 
  
   Why didn't yo post the AJAX code? Isn't that crucial for getting the
  values
   to your CFC? We need to see that.
  
  
   On Wed, Jan 15, 2014 at 2:56 PM, Rick Faircloth 
  r...@whitestonemedia.com
   wrote:
  
   
Hi, all...
   
I've approached this problem from every direction I can think of and
  with
reference to many, many websites, but I still can put together an
  answer.
   
I have this HTML in a form:
   
  cfoutput query = qGetSpecials
   
  div class=special_title_container
  span class=title_checkbox_span
  input id=special_id_#special_id# class=special_title_checkbox
value=#special_title# type=checkbox name=special_title
  /span
  span class=special_title_span#special_title#/span
  /div
   
  /cfoutput
   
Which is output into this:
   
input id=special_id_26 class=special_title_checkbox value=First
Special type=checkbox name=special_title
input id=special_id_27 class=special_title_checkbox
 value=Second
Special type=checkbox name=special_title
input id=special_id_28 class=special_title_checkbox value=Third
Special type=checkbox name=special_title
   
This jQuery processing the inputs:
   
$(document).ready(function() {
   
  $('#newsletter_preview_button').click(function() {
   
  var specialTitleID = $('.special_title_checkbox:checked');
   
  $('.special_title_checkbox:checked').each(function(index,value) {
   
  var specialTitleID = $(this).attr('id').split('_').pop();
  var specialTitleID = 'specialTitle_'+specialTitleID;
   
  alert(specialTitleID); --- [ this alerts the three input values,
 26,
   27,
28, individually when form is submitted ]
   
  });
   
  values =  {   emailNewsletterGreeting:
  emailNewsletterGreeting,
  specialTitleID: specialTitleID}
   
  (Followed by AJAX code...)
   
   
   
   
--
   
   
  
 
 --
Ninety percent of the politicians give the other ten percent a bad
reputation.  Henry Kissinger
   
   
   
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357441
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Rick Faircloth

Thanks for the tip, Jon! I'll have to check out those Chrome Dev Tools!

Rick


On Wed, Jan 15, 2014 at 6:18 PM, Jon Clausen
jon_clau...@silowebworks.comwrote:


 I like Postman because I can manually test  web services, including HTTP
 verbs and enter form and URL variables against services to test responses
 and error handling in a variety of formats. It also has tabs that parse
 your return data, like the network tab does, but in a better format.  It's
 better at functional testing web services, IMHO, than posting AJAX calls
 repeatedly in page.



 [Note: Typo assistance courtesy of iPhone]

  On Jan 15, 2014, at 5:37 PM, Raymond Camden raymondcam...@gmail.com
 wrote:
 
 
  How is that better than the Network tab itself?
 
 
  On Wed, Jan 15, 2014 at 3:59 PM, Jon Clausen
  jon_clau...@silowebworks.comwrote:
 
 
  On a related note, the Postman extension for Chrome is great for testing
  what your remote CFC's are doing with form variables.
 
  On Jan 15, 2014, at 4:53 PM, Jon Clausen 
 jon_clau...@silowebworks.com
  wrote:
 
 
  I would set your argument type as a list and then validate,loop and
  process the list in your CFC method.  If so you’ll need to change your
  each() loop to append the variables in to the list and then post the
 string
  in your $.post() request.
 
  HTH,
  Jon
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357442
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How do I pass this jQuery variable as arguments to a cfc method?

2014-01-15 Thread Raymond Camden

On Wed, Jan 15, 2014 at 5:38 PM, Rick Faircloth r...@whitestonemedia.comwrote:




 It shows [ 27, 28, 26 ] in the console.

 I guess I can just pass that through and have a cfargument type of list
 and parse those ID's with a cfloop to assign them to individual
 cfarguments.

 Or does a cfargument type of list handle the ID's without having to
 break down the list into individual arguments?


Not exactly. You can't pass complex variables like that via HTTP. It has to
be serialized first. I believe jQuery will do that for you- but I'd
probably do it myself - ie, somearray.join(,).





 On Wed, Jan 15, 2014 at 6:00 PM, Raymond Camden raymondcam...@gmail.com
 wrote:


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357443
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: fedex tracking cfc

2013-07-11 Thread Alan Rother

Hey Tim,

Here is my code for doing FedEx tracking - feel free to email me off list
with questions.

=]
cffunction name=trackShipment access=public returntype=struct
!--- Args ---
cfargument name=shippingNumber type=string required=true
 !--- Logic ---
cfscript
var local = {
XMLPacket = '',
cleanedXML = '',
parsedData = '',
sReturn = {
Status = false,
ErrorMessage = ''
}
};
/cfscript
 cftry
cfsavecontent variable=local.XMLPacket
cfoutput
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:v6=http://fedex.com/ws/track/v6;
   soapenv:Header/
   soapenv:Body
  v6:TrackRequest
v6:WebAuthenticationDetail
v6:UserCredential
v6:Key#application.SiteDetails.FedEx.authKey#/v6:Key
v6:Password#application.SiteDetails.FedEx.authPassword#/v6:Password
/v6:UserCredential
/v6:WebAuthenticationDetail
v6:ClientDetail
v6:AccountNumber#application.SiteDetails.FedEx.authAcctNumber#/v6:AccountNumber
v6:MeterNumber#application.SiteDetails.FedEx.authMeterNumber#/v6:MeterNumber
/v6:ClientDetail
 v6:Version
v6:ServiceIdtrck/v6:ServiceId
v6:Major6/v6:Major
v6:Intermediate0/v6:Intermediate
v6:Minor0/v6:Minor
 /v6:Version
 v6:PackageIdentifier
v6:Value#Arguments.shippingNumber#/v6:Value
v6:TypeTRACKING_NUMBER_OR_DOORTAG/v6:Type
 /v6:PackageIdentifier
  /v6:TrackRequest
   /soapenv:Body
/soapenv:Envelope
/cfoutput
/cfsavecontent

cfhttp url=https://ws.fedex.com:443/web-services/track; method=POST
throwonerror=yes
cfhttpparam type=header name=charset value=utf-8
cfhttpparam type=header name=Accept-Encoding value=*
cfhttpparam type=header name=TE value=deflate;q=0
cfhttpparam type=header name=content-type value=text/xml
cfhttpparam type=header name=content-length
value=#len(local.XMLPacket)#
cfhttpparam type=xml name=message
value=#trim(local.XMLPacket)#
/cfhttp
cfscript
//Clean the returned string
local.cleanedXML = CFHTTP.FileContent;
local.cleanedXML = CleanUpXMLString(local.cleanedXML);
//Strip out namespaces references - they just make parsing harder
local.cleanedXML =
local.cleanedXML.ReplaceAll(xmlns(:\w+)?=[^]*,);
local.cleanedXML =
local.cleanedXML.ReplaceAll(diffgr(:\w+)?=[^]*,);
local.cleanedXML =
local.cleanedXML.ReplaceAll(msdata(:\w+)?=[^]*,);
local.cleanedXML = local.cleanedXML.ReplaceAll(xsi(:\w+)?=[^]*,);
local.cleanedXML = local.cleanedXML.ReplaceAll((/?)(\w+:),$1);
 if(IsXML(TRIM(local.cleanedXML))){
//parse it
local.parsedData = XMLParse(local.cleanedXML);
writeDump(var=local.parsedData,abort=true);
}
else{
writeDump(var=CFHTTP.FileContent,abort=true);
}
/cfscript
 cfcatch type=any
cfdump var=#cfcatch#cfabort
/cfcatch
/cftry
!--- Return ---
cfreturn local.sReturn /
/cffunction


On Wed, Jul 10, 2013 at 6:40 AM, John M Bliss bliss.j...@gmail.com wrote:


 Also, CF makes consuming webservices pretty easy with built-in stuff:

 http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-714a.html


 On Wed, Jul 10, 2013 at 8:34 AM, Matthew Williams
 mai...@geodesicgrafx.comwrote:

 
  Have you tried here?  https://code.google.com/p/cffedexrates/.  It uses
  XML
  and CFHTTP.  It should at least point you in the direction of what to
 send
  the tracking API.
 
 
  --
 
  Matthew Williams
  Geodesic GraFX
  www.geodesicgrafx.com/blog
  http://twitter.com/ophblance
 
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356167
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: fedex tracking cfc

2013-07-11 Thread Alan Rother

Here is my code for doing FedEx tracking - feel free to email me off list
with questions.

=]
cffunction name=trackShipment access=public returntype=struct
!--- Args ---
cfargument name=shippingNumber type=string required=true
 !--- Logic ---
cfscriptvar local = {XMLPacket = '',cleanedXML = '',parsedData =
'',sReturn = {Status = false,ErrorMessage = ''}};/cfscript
 cftry
cfsavecontent variable=local.XMLPacket
cfoutput
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:v6=http://fedex.com/ws/track/v6;
   soapenv:Header/
   soapenv:Body
  v6:TrackRequest
v6:WebAuthenticationDetail
v6:UserCredential
v6:Key#application.SiteDetails.FedEx.authKey#/v6:Key
v6:Password#application.SiteDetails.FedEx.authPassword#/v6:Password
/v6:UserCredential
/v6:WebAuthenticationDetail
v6:ClientDetail
v6:AccountNumber#application.SiteDetails.FedEx.authAcctNumber#/v6:AccountNumber
v6:MeterNumber#application.SiteDetails.FedEx.authMeterNumber#/v6:MeterNumber
/v6:ClientDetail
 v6:Version
v6:ServiceIdtrck/v6:ServiceId
v6:Major6/v6:Major
v6:Intermediate0/v6:Intermediate
v6:Minor0/v6:Minor
 /v6:Version
 v6:PackageIdentifier
v6:Value#Arguments.shippingNumber#/v6:Value
v6:TypeTRACKING_NUMBER_OR_DOORTAG/v6:Type
 /v6:PackageIdentifier
  /v6:TrackRequest
   /soapenv:Body
/soapenv:Envelope
/cfoutput
/cfsavecontent

cfhttp url=https://ws.fedex.com:443/web-services/track; method=POST
throwonerror=yes
cfhttpparam type=header name=charset value=utf-8
cfhttpparam type=header name=Accept-Encoding value=*
cfhttpparam type=header name=TE value=deflate;q=0
cfhttpparam type=header name=content-type value=text/xml
cfhttpparam type=header name=content-length
value=#len(local.XMLPacket)#
cfhttpparam type=xml name=message
value=#trim(local.XMLPacket)#
/cfhttp
cfscript
//Clean the returned string
local.cleanedXML = CFHTTP.FileContent;
local.cleanedXML = CleanUpXMLString(local.cleanedXML);
//Strip out namespaces references - they just make parsing harder
local.cleanedXML =
local.cleanedXML.ReplaceAll(xmlns(:\w+)?=[^]*,);
local.cleanedXML =
local.cleanedXML.ReplaceAll(diffgr(:\w+)?=[^]*,);
local.cleanedXML =
local.cleanedXML.ReplaceAll(msdata(:\w+)?=[^]*,);
local.cleanedXML = local.cleanedXML.ReplaceAll(xsi(:\w+)?=[^]*,);
local.cleanedXML = local.cleanedXML.ReplaceAll((/?)(\w+:),$1);
 if(IsXML(TRIM(local.cleanedXML))){
//parse it
local.parsedData = XMLParse(local.cleanedXML);
writeDump(var=local.parsedData,abort=true);
}
else{
writeDump(var=CFHTTP.FileContent,abort=true);
}
/cfscript
 cfcatch type=any
cfdump var=#cfcatch#cfabort
/cfcatch
/cftry
!--- Return ---
cfreturn local.sReturn /
/cffunction

Alan Rother
Manager, Phoenix Cold Fusion User Group, www.AZCFUG.org
Twitter: @AlanRother


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356168
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: fedex tracking cfc

2013-07-10 Thread Matthew Williams

Have you tried here?  https://code.google.com/p/cffedexrates/.  It uses XML
and CFHTTP.  It should at least point you in the direction of what to send
the tracking API.


-- 

Matthew Williams
Geodesic GraFX
www.geodesicgrafx.com/blog
http://twitter.com/ophblance


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356154
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: fedex tracking cfc

2013-07-10 Thread John M Bliss

Also, CF makes consuming webservices pretty easy with built-in stuff:
http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-714a.html


On Wed, Jul 10, 2013 at 8:34 AM, Matthew Williams
mai...@geodesicgrafx.comwrote:


 Have you tried here?  https://code.google.com/p/cffedexrates/.  It uses
 XML
 and CFHTTP.  It should at least point you in the direction of what to send
 the tracking API.


 --

 Matthew Williams
 Geodesic GraFX
 www.geodesicgrafx.com/blog
 http://twitter.com/ophblance


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356155
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


fedex tracking cfc

2013-07-09 Thread Tim Do

Can anybody point me in the right direction to get some implementation 
instruction using fedex's wsdl? They only have samples for vb.net, php, c# 
etc...  Why is it so painful to find anything related to coldfusion and fedex 
implementation. I have an account number, identifier (meter) and an reference 
number (no tracking number) and would like to get tracking info from fedex. Any 
help would be appreciated.

Thanks,
Tim



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356142
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Easy CFC question (I hope)

2013-05-09 Thread Bruce Sorge

Hey,
I am doing a project for my CF class in college. I admit that I have not played 
with CFC's in a while, but I cannot figure out why this is not working:

cffunction name=adduser hint=Adds a new user to the database 
returntype=query
cfargument name=fname required=true type=string
cfargument name=lname required=true type=string
cfargument name=username required=true type=string
cfargument name=userpwd required=true type=string
cfargument name=email required=true type=string

cfset var adduser =  /
!--- Hash the password and create a random number for the URL 
on the email that will be sent ---
cfset securepwd = #hash(arguments.userpwd)# /
cfset salt = #Rand(SHA1PRNG)# /
cfset secureHash = hash(salt) /


cfquery name=qUserID result=userid 
datasource=bhsrecruitadmindsn
INSERT INTO users
(username, userpwd, fname, lname, email, secureHash)
VALUES ('#arguments.username#', '#securepwd#', 
'#arguments.fname#', '#arguments.lname#', '#arguments.email#', '#secureHash#')
/cfquery

!--- Set the auto generated key ---
cfset newID = #userid.generated_key# /
!--- Now we get the informatoion from the db ---
cfquery name=qUserEmail
SELECT fname, lname, email, secureHash
FROM users
WHERE userid = #newID#
/cfquery

cfreturn adduser
/cffunction

The information enters into the db as expected, but when I invoke the component 
on the other end:

cfinvoke method=adduser component=cfc/dbfunctions 
returnvariable=userinfo
cfinvokeargument name=username value=#form.username#
cfinvokeargument name=userpwd value=#form.userpwd#
cfinvokeargument name=fname value=#form.fname#
cfinvokeargument name=lname value=#form.lname#
cfinvokeargument name=email value=#form.email#
/cfinvoke

I get the error message The value returned from the adduser function is not of 
type query. If the component name is specified as a return type, it is possible 
that either a definition file for the component cannot be found or is not 
accessible. The error occurred on line 16.

Also, I know that there are a few things that could be fixed/tidied up 
regarding hashing and such, but this class is not on encryption or anything 
like that, it's so that the instructor see's that I have a basic understanding 
of CF. The book for the class is CFWAC for version 9, so it's beginner level 
stuff.

Bruce

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355669
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread morgan lindley

Change your return to:
cfretun qUserEmail

As you have it, it's attempting to return a reference to the adduser method.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355671
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Dave Watts

 cffunction name=adduser hint=Adds a new user to the database 
 returntype=query
 ...
 cfquery name=qUserEmail
 SELECT fname, lname, email, secureHash
 FROM users
 WHERE userid = #newID#
 /cfquery

 cfreturn adduser
 /cffunction

 The information enters into the db as expected, but when I invoke the 
 component on the other end:

 cfinvoke method=adduser component=cfc/dbfunctions 
 returnvariable=userinfo
 cfinvokeargument name=username value=#form.username#
 cfinvokeargument name=userpwd value=#form.userpwd#
 cfinvokeargument name=fname value=#form.fname#
 cfinvokeargument name=lname value=#form.lname#
 cfinvokeargument name=email value=#form.email#
 /cfinvoke

 I get the error message The value returned from the adduser function is not 
 of type query. If the component name is specified as a
 return type, it is possible that either a definition file for the component 
 cannot be found or is not accessible. The error occurred on line 16.

You specified that the component returns a query object in the first
line. But you're trying to return an instance of the component. You
need to change one or the other. In this case, you probably want to
change your CFRETURN to return the query object:

cfreturn qUserEmail

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355672
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Bruce Sorge

Damn it. Stupid rookie mistake. 

Sent from my iPhone 4S. 

On May 9, 2013, at 11:55 AM, morgan lindley greyk...@gmail.com wrote:

 
 Change your return to:
 cfretun qUserEmail
 
 As you have it, it's attempting to return a reference to the adduser method.
 
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355673
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Easy CFC question (I hope)

2013-05-09 Thread DURETTE, STEVEN J

Actually up higher he does a cfset var adduser =  / so he is actually 
returning a variable. He can solve it either using your way or by doing a 
cfset adduser = qUserEmail / before the cfreturn.

I just mention this because if he inspected the results he wouldn't get back 
that he was returning an instance of the component, just a simple variable.

I know a lot of people who declare some sort of return variable and set it at 
the end just before returning. 

Steve

-Original Message-
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: Thursday, May 09, 2013 11:57 AM
To: cf-talk
Subject: Re: Easy CFC question (I hope)

snip

You specified that the component returns a query object in the first
line. But you're trying to return an instance of the component. You
need to change one or the other. In this case, you probably want to
change your CFRETURN to return the query object:

cfreturn qUserEmail

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355674
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Bruce Sorge

I just did what dave and morgan suggested and it worked like a charm. 
Embarrassed that I made this beginner mistake. I have about six or so more 
functions above this one that all work fine, just didn't pay attention to 
details on this one. 

Bruce
On May 9, 2013, at 12:02 PM, DURETTE, STEVEN J sd1...@att.com wrote:

 
 Actually up higher he does a cfset var adduser =  / so he is actually 
 returning a variable. He can solve it either using your way or by doing a 
 cfset adduser = qUserEmail / before the cfreturn.
 
 I just mention this because if he inspected the results he wouldn't get back 
 that he was returning an instance of the component, just a simple variable.
 
 I know a lot of people who declare some sort of return variable and set it at 
 the end just before returning. 
 
 Steve
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355676
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Dave Watts

 Actually up higher he does a cfset var adduser =  / so he is actually 
 returning a variable. He can solve it either
 using your way or by doing a cfset adduser = qUserEmail / before the 
 cfreturn.

I didn't see that. I would recommend against creating a variable with
the same name as the component, though.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355677
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Easy CFC question (I hope)

2013-05-09 Thread DURETTE, STEVEN J

You might want to remove the cfset var adduser =  / since it isn't used 
then. Clean code is easier to troubleshoot.

That's just my .01 (I'm too cheap to give 2 cents!) LOL.

-Original Message-
From: Bruce Sorge [mailto:sor...@gmail.com] 
Sent: Thursday, May 09, 2013 12:06 PM
To: cf-talk
Subject: Re: Easy CFC question (I hope)


I just did what dave and morgan suggested and it worked like a charm. 
Embarrassed that I made this beginner mistake. I have about six or so more 
functions above this one that all work fine, just didn't pay attention to 
details on this one. 

Bruce

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355678
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Easy CFC question (I hope)

2013-05-09 Thread Ian Chapman

Chnage to cfreturn qUserEmail

-Original Message-
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: 09 May 2013 16:57
To: cf-talk
Subject: Re: Easy CFC question (I hope)


 cffunction name=adduser hint=Adds a new user to the database 
 returntype=query ...
 cfquery name=qUserEmail
 SELECT fname, lname, email, secureHash
 FROM users
 WHERE userid = #newID#
 /cfquery

 cfreturn adduser
 /cffunction

 The information enters into the db as expected, but when I invoke the
component on the other end:

 cfinvoke method=adduser component=cfc/dbfunctions
returnvariable=userinfo
 cfinvokeargument name=username value=#form.username#
 cfinvokeargument name=userpwd value=#form.userpwd#
 cfinvokeargument name=fname value=#form.fname#
 cfinvokeargument name=lname value=#form.lname#
 cfinvokeargument name=email value=#form.email# 
 /cfinvoke

 I get the error message The value returned from the adduser function 
 is not of type query. If the component name is specified as a return type,
it is possible that either a definition file for the component cannot be
found or is not accessible. The error occurred on line 16.

You specified that the component returns a query object in the first line.
But you're trying to return an instance of the component. You need to change
one or the other. In this case, you probably want to change your CFRETURN to
return the query object:

cfreturn qUserEmail

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule,
and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355679
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Bruce Sorge

Already done. And I'm stepping away from the computer or a bit. Heh. 

Sent from my iPhone 4S. 

On May 9, 2013, at 12:10 PM, DURETTE, STEVEN J sd1...@att.com wrote:

 
 You might want to remove the cfset var adduser =  / since it isn't used 
 then. Clean code is easier to troubleshoot.
 
 That's just my .01 (I'm too cheap to give 2 cents!) LOL.
 
 -Original Message-
 From: Bruce Sorge [mailto:sor...@gmail.com] 
 Sent: Thursday, May 09, 2013 12:06 PM
 To: cf-talk
 Subject: Re: Easy CFC question (I hope)
 
 
 I just did what dave and morgan suggested and it worked like a charm. 
 Embarrassed that I made this beginner mistake. I have about six or so more 
 functions above this one that all work fine, just didn't pay attention to 
 details on this one. 
 
 Bruce
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355680
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Mike K

Bruce I wouldn't sweat about making a rookie mistake.We all do.   Mine
is usually confusing 'eq' and '='.   as in ...

cfif variable1 eq variable2  /cfif

and

cfset variable1 = something 

I usually find out I've got them the wrong way round when I get an error
message.   You'd think something as simple as that would be easy to
remember,  if only because it trips me up so many times.But no.
So don't worry about it.   Anyway,  any programmer that tells you they
usually write code that works first time as advertised is quite probably a
liar.

What is important is to learn how you diagnose your own errors and fix them
yourself before anyone else gets involved.  You're going to keep making
mistakes,  either simply syntax mistakes or errors in code logic.The
skilled programmers learn how to look for potential minefields as they go,
and check each segment of code as they develop, so the finished code is as
robust as it's possible to be before they let anyone else test it.That
way they get the reputation of being invincible. It's all smoke and
mirrors though.   They're not invincible - they just paper over the cracks
 before anyone sees  (to mix metaphors).

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month


On Fri, May 10, 2013 at 2:12 AM, Bruce Sorge sor...@gmail.com wrote:


 Already done. And I'm stepping away from the computer or a bit. Heh.

 Sent from my iPhone 4S.

 On May 9, 2013, at 12:10 PM, DURETTE, STEVEN J sd1...@att.com wrote:

 
  You might want to remove the cfset var adduser =  / since it isn't
 used then. Clean code is easier to troubleshoot.
 
  That's just my .01 (I'm too cheap to give 2 cents!) LOL.
 
  -Original Message-
  From: Bruce Sorge [mailto:sor...@gmail.com]
  Sent: Thursday, May 09, 2013 12:06 PM
  To: cf-talk
  Subject: Re: Easy CFC question (I hope)
 
 
  I just did what dave and morgan suggested and it worked like a charm.
 Embarrassed that I made this beginner mistake. I have about six or so more
 functions above this one that all work fine, just didn't pay attention to
 details on this one.
 
  Bruce
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355681
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Easy CFC question (I hope)

2013-05-09 Thread Eric Roberts

adduser is set to ...unless i missed it, i do't see it being assigned the
return value of the query.  If you are supposed to be returning the new ID
then you would want cfreturn qUserEmail

Eric


On Thu, May 9, 2013 at 10:49 AM, Bruce Sorge sor...@gmail.com wrote:


 Hey,
 I am doing a project for my CF class in college. I admit that I have not
 played with CFC's in a while, but I cannot figure out why this is not
 working:

 cffunction name=adduser hint=Adds a new user to the database
 returntype=query
 cfargument name=fname required=true type=string
 cfargument name=lname required=true type=string
 cfargument name=username required=true type=string
 cfargument name=userpwd required=true type=string
 cfargument name=email required=true type=string

 cfset var adduser =  /
 !--- Hash the password and create a random number for the
 URL on the email that will be sent ---
 cfset securepwd = #hash(arguments.userpwd)# /
 cfset salt = #Rand(SHA1PRNG)# /
 cfset secureHash = hash(salt) /


 cfquery name=qUserID result=userid
 datasource=bhsrecruitadmindsn
 INSERT INTO users
 (username, userpwd, fname, lname, email,
 secureHash)
 VALUES ('#arguments.username#', '#securepwd#',
 '#arguments.fname#', '#arguments.lname#', '#arguments.email#',
 '#secureHash#')
 /cfquery

 !--- Set the auto generated key ---
 cfset newID = #userid.generated_key# /
 !--- Now we get the informatoion from the db ---
 cfquery name=qUserEmail
 SELECT fname, lname, email, secureHash
 FROM users
 WHERE userid = #newID#
 /cfquery

 cfreturn adduser
 /cffunction

 The information enters into the db as expected, but when I invoke the
 component on the other end:

 cfinvoke method=adduser component=cfc/dbfunctions
 returnvariable=userinfo
 cfinvokeargument name=username value=#form.username#
 cfinvokeargument name=userpwd value=#form.userpwd#
 cfinvokeargument name=fname value=#form.fname#
 cfinvokeargument name=lname value=#form.lname#
 cfinvokeargument name=email value=#form.email#
 /cfinvoke

 I get the error message The value returned from the adduser function is
 not of type query. If the component name is specified as a return type, it
 is possible that either a definition file for the component cannot be found
 or is not accessible. The error occurred on line 16.

 Also, I know that there are a few things that could be fixed/tidied up
 regarding hashing and such, but this class is not on encryption or anything
 like that, it's so that the instructor see's that I have a basic
 understanding of CF. The book for the class is CFWAC for version 9, so it's
 beginner level stuff.

 Bruce

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355682
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: How can I view arguments in a CFC on-screen?

2013-04-02 Thread Rick Faircloth

When I put this inside a function of a CFC, right after thearguments 
declarations: cfdump var = '#arguments#' output='e:\dump.html' 
format='html'orcfdump var = '#arguments#' output='console' format='text' I 
get this error message from CF: Context validation error for the cffunction tag.
The start tag must have a matching end tag.
An explicit end tag can be provided by adding
lt;/cffunctiongt;.  If the body of the tag is empty,
\you can use the shortcut lt;cffunction .../ It's as if the cfdump is causing 
CF not to recognize
the closing /cffunction tag.

Am I putting the cfdump in the wrong place in the method?Thanks!Rick
  To: cf-talk@houseoffusion.com
 Subject: Re: How can I view arguments in a CFC on-screen?
 Date: Mon, 1 Apr 2013 19:06:31 -0400
 From: dswit...@pengoworks.com
 
 
 Use the step debugger.
 
 On Monday, April 1, 2013, Russ Michaels wrote:
 
 
  Dump them all to a file, then view the file.
 
  Regards
  Russ Michaels
  www.michaels.me.uk
  www.cfmldeveloper.com - Free CFML hosting for developers
  www.cfsearch.com - CF search engine
  On Apr 1, 2013 6:36 PM, Rick Faircloth 
  r...@whitestonemedia.comjavascript:;
  wrote:
 
  
   I wouldn't think this would be that difficult! Normally, I would include
   variables in a struct (when I'm using AJAX, whichis almost always) and
  view
   the variables when they're returned to the calling page. However, there
  are
   times, like right now, when I just want to have a look at allthe argument
   variables that a CFC is receiving and verify their accuracy. Isn't there
  an
   easy way to do this? I'm using CF 9. Thanks! Rick
  
  
 
  
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355222
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: How can I view arguments in a CFC on-screen?

2013-04-02 Thread Rick Faircloth

The way I finally got to view the arguments sent to the CFC methodwas by simply 
assigning the arguments to the struct I created: cfset authorizeStruct  = 
structNew() / cfset authorizeStruct.ARGUMENTS = '#arguments#' / cfreturn 
authorizeStruct / That put a halt to all further processing in the method, 
which is good,and sent back the name pairs in JSON so I could view them in the 
console.
 From: r...@whitestonemedia.com
To: cf-talk@houseoffusion.com
Subject: RE: How can I view arguments in a CFC on-screen?
Date: Tue, 2 Apr 2013 10:39:18 -0400




When I put this inside a function of a CFC, right after the
arguments declarations:
 
cfdump var = '#arguments#' output='e:\dump.html' format='html'
or
cfdump var = '#arguments#' output='console' format='text'
 
I get this error message from CF:
 
Context validation error for the cffunction tag.
The start tag must have a matching end tag.
An explicit end tag can be provided by adding
lt;/cffunctiongt;.  If the body of the tag is empty,
\you can use the shortcut lt;cffunction .../ It's as if the cfdump is causing 
CF not to recognize
the closing /cffunction tag.

Am I putting the cfdump in the wrong place in the method?Thanks!Rick
 
 To: cf-talk@houseoffusion.com
 Subject: Re: How can I view arguments in a CFC on-screen?
 Date: Mon, 1 Apr 2013 19:06:31 -0400
 From: dswit...@pengoworks.com
 
 
 Use the step debugger.
 
 On Monday, April 1, 2013, Russ Michaels wrote:
 
 
  Dump them all to a file, then view the file.
 
  Regards
  Russ Michaels
  www.michaels.me.uk
  www.cfmldeveloper.com - Free CFML hosting for developers
  www.cfsearch.com - CF search engine
  On Apr 1, 2013 6:36 PM, Rick Faircloth 
  r...@whitestonemedia.comjavascript:;
  wrote:
 
  
   I wouldn't think this would be that difficult! Normally, I would include
   variables in a struct (when I'm using AJAX, whichis almost always) and
  view
   the variables when they're returned to the calling page. However, there
  are
   times, like right now, when I just want to have a look at allthe argument
   variables that a CFC is receiving and verify their accuracy. Isn't there
  an
   easy way to do this? I'm using CF 9. Thanks! Rick
  
  
 
  
 
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355223
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


How can I view arguments in a CFC on-screen?

2013-04-01 Thread Rick Faircloth

I wouldn't think this would be that difficult! Normally, I would include 
variables in a struct (when I'm using AJAX, whichis almost always) and view the 
variables when they're returned to the calling page. However, there are times, 
like right now, when I just want to have a look at allthe argument variables 
that a CFC is receiving and verify their accuracy. Isn't there an easy way to 
do this? I'm using CF 9. Thanks! Rick  

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355213
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How can I view arguments in a CFC on-screen?

2013-04-01 Thread Rob Parkhill

Sure

cfdump var=#arguments# output=c:/temp.html format=html /

That will throw all the arguments into an html file on the c drive.

Cheers,

Rob
On 2013-04-01 1:36 PM, Rick Faircloth r...@whitestonemedia.com wrote:


 I wouldn't think this would be that difficult! Normally, I would include
 variables in a struct (when I'm using AJAX, whichis almost always) and view
 the variables when they're returned to the calling page. However, there are
 times, like right now, when I just want to have a look at allthe argument
 variables that a CFC is receiving and verify their accuracy. Isn't there an
 easy way to do this? I'm using CF 9. Thanks! Rick

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355215
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How can I view arguments in a CFC on-screen?

2013-04-01 Thread Russ Michaels

Dump them all to a file, then view the file.

Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On Apr 1, 2013 6:36 PM, Rick Faircloth r...@whitestonemedia.com wrote:


 I wouldn't think this would be that difficult! Normally, I would include
 variables in a struct (when I'm using AJAX, whichis almost always) and view
 the variables when they're returned to the calling page. However, there are
 times, like right now, when I just want to have a look at allthe argument
 variables that a CFC is receiving and verify their accuracy. Isn't there an
 easy way to do this? I'm using CF 9. Thanks! Rick

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355216
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How can I view arguments in a CFC on-screen?

2013-04-01 Thread Dan G. Switzer, II

Use the step debugger.

On Monday, April 1, 2013, Russ Michaels wrote:


 Dump them all to a file, then view the file.

 Regards
 Russ Michaels
 www.michaels.me.uk
 www.cfmldeveloper.com - Free CFML hosting for developers
 www.cfsearch.com - CF search engine
 On Apr 1, 2013 6:36 PM, Rick Faircloth 
 r...@whitestonemedia.comjavascript:;
 wrote:

 
  I wouldn't think this would be that difficult! Normally, I would include
  variables in a struct (when I'm using AJAX, whichis almost always) and
 view
  the variables when they're returned to the calling page. However, there
 are
  times, like right now, when I just want to have a look at allthe argument
  variables that a CFC is receiving and verify their accuracy. Isn't there
 an
  easy way to do this? I'm using CF 9. Thanks! Rick
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355221
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc WSDL is cached and won't let go

2013-02-27 Thread Dale Western

I had this problem and it turned out that the cfcomponent displayname must be 
different to the name of the webservice. So 

if you have 

myWebService.cfc?wsdl

and inside it

cfcomponent displayname=myWebService output=false

then boom!

doing this sorts the problem

cfcomponent displayname=myWebServiceFixed output=false 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354705
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc WSDL is cached and won't let go

2013-02-27 Thread Dale Western

I had this problem and it turned out that the cfcomponent displayname must be 
different to the name of the webservice. So 

if you have 

myWebService.cfc?wsdl

and inside it

cfcomponent displayname=myWebService output=false

then boom!

doing this sorts the problem

cfcomponent displayname=myWebServiceFixed output=false 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354706
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc WSDL is cached and won't let go

2013-02-27 Thread Raymond Camden

Can you file a bug report for that please?

https://bugbase.adobe.com/


On Wed, Feb 27, 2013 at 7:55 AM, Dale Western 
dale.west...@columbusdirect.com wrote:


 I had this problem and it turned out that the cfcomponent displayname must
 be different to the name of the webservice. So

 if you have

 myWebService.cfc?wsdl

 and inside it

 cfcomponent displayname=myWebService output=false

 then boom!

 doing this sorts the problem

 cfcomponent displayname=myWebServiceFixed output=false

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354712
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Magento CFC or sample code

2013-02-22 Thread Scott Stevens

I need to interact with a Magento store and was wondering if there were any 
existing CFCs or sample code for interacting with the Magento API.  I search 
the forum but couldn't find anything initially.

Thanks. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354644
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


CFC/JSON problem saving long text fields

2013-01-04 Thread Darla Tande

Happy New Year everyone,

I get a 404 error (in firebug) whenever I try to save a long text field to SQL 
server.  I have a CFWINDOW that opens to allow editing and a save button calls 
the CFC.  I separated out the description from the remainder of the record 
trying to get this to work.  I ended up working around this by splitting the 
text into 500 char chunks and saving it that way.  This solution is not working 
well in production.  So, I would like to find a way to do it without looping.  
I've trapped the error on the javascript side and it just says 'undefined' for 
the error's message.  I added a simple insert query to the top of the CFC 
function and that did not occur.  So, the problem appears to be on the 
javascript side.

Any ideas?

I have CF 9, SQL Server 2008, description is varchar(max)

Javascript call:

dataproxy.saveDescription(
frm.prdID.value,
frm.prdDescription.value
);

CFC Function:
cffunction name=saveDescription
cfargument name=prdID type=numeric default=0
cfargument name=prdDesc type=string default= 
   
   cfquery datasource=#THIS.dsn#
 UPDATE tblProducts
 SET prdDescription= 
  cfqueryparam cfsqltype=cf_sql_longvarchar 
value=#arguments.prdDesc#  
 WHERE prdID= 
  cfqueryparam cfsqltype=cf_sql_int value=#arguments.prdID#  /  
   /cfquery
/cffunction 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353762
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC/JSON problem saving long text fields

2013-01-04 Thread Raymond Camden

You are hitting a GET versus POST thing. GET has a limited size. Just
switch to POST.


On Fri, Jan 4, 2013 at 10:21 AM, Darla Tande da...@bis-net.net wrote:


 Happy New Year everyone,

 I get a 404 error (in firebug) whenever I try to save a long text field to
 SQL server.  I have a CFWINDOW that opens to allow editing and a save
 button calls the CFC.  I separated out the description from the remainder
 of the record trying to get this to work.  I ended up working around this
 by splitting the text into 500 char chunks and saving it that way.  This
 solution is not working well in production.  So, I would like to find a way
 to do it without looping.  I've trapped the error on the javascript side
 and it just says 'undefined' for the error's message.  I added a simple
 insert query to the top of the CFC function and that did not occur.  So,
 the problem appears to be on the javascript side.

 Any ideas?

 I have CF 9, SQL Server 2008, description is varchar(max)

 Javascript call:

 dataproxy.saveDescription(
 frm.prdID.value,
 frm.prdDescription.value
 );

 CFC Function:
 cffunction name=saveDescription
 cfargument name=prdID type=numeric default=0
 cfargument name=prdDesc type=string default= 

cfquery datasource=#THIS.dsn#
  UPDATE tblProducts
  SET prdDescription=
   cfqueryparam cfsqltype=cf_sql_longvarchar
 value=#arguments.prdDesc# 
  WHERE prdID=
   cfqueryparam cfsqltype=cf_sql_int value=#arguments.prdID#
  /
/cfquery
 /cffunction

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353763
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC/JSON problem saving long text fields

2013-01-04 Thread Raymond Camden

FYI, it would have helped if I told you what to do. Just do this in your JS:

dataproxy.setHTTPMethod(post)


On Fri, Jan 4, 2013 at 10:35 AM, Raymond Camden raymondcam...@gmail.comwrote:

 You are hitting a GET versus POST thing. GET has a limited size. Just
 switch to POST.


 On Fri, Jan 4, 2013 at 10:21 AM, Darla Tande da...@bis-net.net wrote:


 Happy New Year everyone,

 I get a 404 error (in firebug) whenever I try to save a long text field
 to SQL server.  I have a CFWINDOW that opens to allow editing and a save
 button calls the CFC.  I separated out the description from the remainder
 of the record trying to get this to work.  I ended up working around this
 by splitting the text into 500 char chunks and saving it that way.  This
 solution is not working well in production.  So, I would like to find a way
 to do it without looping.  I've trapped the error on the javascript side
 and it just says 'undefined' for the error's message.  I added a simple
 insert query to the top of the CFC function and that did not occur.  So,
 the problem appears to be on the javascript side.

 Any ideas?

 I have CF 9, SQL Server 2008, description is varchar(max)

 Javascript call:

 dataproxy.saveDescription(
 frm.prdID.value,
 frm.prdDescription.value
 );

 CFC Function:
 cffunction name=saveDescription
 cfargument name=prdID type=numeric default=0
 cfargument name=prdDesc type=string default= 

cfquery datasource=#THIS.dsn#
  UPDATE tblProducts
  SET prdDescription=
   cfqueryparam cfsqltype=cf_sql_longvarchar
 value=#arguments.prdDesc# 
  WHERE prdID=
   cfqueryparam cfsqltype=cf_sql_int value=#arguments.prdID#
  /
/cfquery
 /cffunction

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353764
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC/JSON problem saving long text fields

2013-01-04 Thread Darla Smith

That did it!  Thanks. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353768
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Asynchronous action inside CFC function

2012-11-13 Thread Christophe Maso

Hi I have a function that gets some binary data, uses that data to do a cffile 
action=write, and then returns the file's path as a string. I'm experiencing a 
problem that suggests the function is doing the return before the write action 
has completed. In the code below, will the function wait for the write action 
to complete before it sends the return? I'm almost certain it will not; is 
there a way to force the function to wait for the write to complete before it 
returns strWPTempFilePath, such as cftransaction or something along those lines?

cfset strWPTempFilePath = request.stcApplicationData.strTempImageDirectory  
createUuid()  .pdf
cffile action=WRITE file=#strWPTempFilePath# output=#r_docBinData# 
addNewLine=no /
cfreturn strWPTempFilePath 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353141
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Asynchronous action inside CFC function

2012-11-13 Thread Russ Michaels

You could use a do while file not exists loop to wait till the file gets
written.

Regards
Russ Michaels
On Nov 13, 2012 5:26 PM, Christophe Maso zum...@hotmail.com wrote:


 Hi I have a function that gets some binary data, uses that data to do a
 cffile action=write, and then returns the file's path as a string. I'm
 experiencing a problem that suggests the function is doing the return
 before the write action has completed. In the code below, will the function
 wait for the write action to complete before it sends the return? I'm
 almost certain it will not; is there a way to force the function to wait
 for the write to complete before it returns strWPTempFilePath, such as
 cftransaction or something along those lines?

 cfset strWPTempFilePath =
 request.stcApplicationData.strTempImageDirectory  createUuid()  .pdf
 cffile action=WRITE file=#strWPTempFilePath# output=#r_docBinData#
 addNewLine=no /
 cfreturn strWPTempFilePath

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353142
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Inline logic vs CFC vs SP

2012-10-23 Thread Shannon Rhodes

I'm drafting our first set of code standards, and I'm running into a 
philosophical debate which I'd like to open up to the community.  

Some would say our standard should be to place all queries and as much 
execution logic as possible into CFCs.  The advantages of this are:  most of 
your business logic is centralized; if you have to make major changes (like the 
time we had to copy most of an app's functionality over but change a large 
percentage of the schema references) it's easy to find most of the relevant 
code; and, you can often make major changes to an application without pushing 
more than one or two files to production.

Others argue that code only belongs in a CFC if we can expect that code to be 
reused.  So, if a piece of functionality is extremely specific, and therefore 
not likely to be called elsewhere, then why take the extra step of abstracting 
to an object.  The pet peeve illustrated here is a submit handler page that 
contains nothing but a call to a CFC, which apparently annoys when business 
logic is expected on the handler page.

Still others would have us put most logic in stored procedures (which produces 
the sub-debate of whether it's redundant to call a CFC that calls a stored 
procedure).  First, I have to note that we are on Oracle, and personally I 
don't find it nearly as easy to debug stored procedures in Oracle as it is in 
SQL Server.  Second, I have heard that performance improvement is minimal, and 
security differences aren't noteworthy provided that you're using cfqueryparam. 
 Third, we would lose database portability (there has been talk of moving to 
SQL Server, which powers our SharePoint site; of course, there have also been 
rumblings of moving us to .Net in which case there's no particular advantage 
either way to storing business logic in the database layer versus the 
application layer).

Then there are a couple of folks pushing for frameworks, but I don't think 
we're quite ready for that yet.

So...inline code if reusability is unlikely?  Everything in CFCs?  Forget CFCs, 
go to stored procedures?  Some rationale for when to use what?  Very interested 
in hearing your opinions!  Thanks. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352977
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Inline logic vs CFC vs SP

2012-10-23 Thread Matt Quackenbush

It's all about encapsulation. Code should be written in one place, and one
place only. If you have the same code in two places, something is wrong.
CFCs - which are objects in the CFML world - are all about encapsulation.
CFCs FTW!

Is that to say that CFMs can't be encapsulated?  No. With very careful
coding and strict architecture in place, CFMs can, in theory, be
encapsulated. But they are not, technically speaking, encapsulated, and
open up many opportunities for code smell and duplicate code to enter into
your application.

I personally am not even remotely a fan of stored procedures. You've
already enumerated several of the arguments against them. But the bottom
line is portability. I am a firm believer in a portable code base, and
therefore don't use stored procedures.

In the simplest of terms:

   - controller-level code goes in CFCs (very light/thin, traffic cop
   only)
   - service/DAO/model-level code goes in CFCs (very robust, intelligent,
   virtually all logic)
   - display/view-level code goes in CFMs (very light/thin, displays data
   and data collection - no business rules/logic)

HTH

On Tue, Oct 23, 2012 at 8:55 AM, Shannon Rhodes shan...@rhodesedge.comwrote:


 I'm drafting our first set of code standards, and I'm running into a
 philosophical debate which I'd like to open up to the community.

 Some would say our standard should be to place all queries and as much
 execution logic as possible into CFCs.  The advantages of this are:  most
 of your business logic is centralized; if you have to make major changes
 (like the time we had to copy most of an app's functionality over but
 change a large percentage of the schema references) it's easy to find most
 of the relevant code; and, you can often make major changes to an
 application without pushing more than one or two files to production.

 Others argue that code only belongs in a CFC if we can expect that code to
 be reused.  So, if a piece of functionality is extremely specific, and
 therefore not likely to be called elsewhere, then why take the extra step
 of abstracting to an object.  The pet peeve illustrated here is a submit
 handler page that contains nothing but a call to a CFC, which apparently
 annoys when business logic is expected on the handler page.

 Still others would have us put most logic in stored procedures (which
 produces the sub-debate of whether it's redundant to call a CFC that calls
 a stored procedure).  First, I have to note that we are on Oracle, and
 personally I don't find it nearly as easy to debug stored procedures in
 Oracle as it is in SQL Server.  Second, I have heard that performance
 improvement is minimal, and security differences aren't noteworthy provided
 that you're using cfqueryparam.  Third, we would lose database portability
 (there has been talk of moving to SQL Server, which powers our SharePoint
 site; of course, there have also been rumblings of moving us to .Net in
 which case there's no particular advantage either way to storing business
 logic in the database layer versus the application layer).

 Then there are a couple of folks pushing for frameworks, but I don't think
 we're quite ready for that yet.

 So...inline code if reusability is unlikely?  Everything in CFCs?  Forget
 CFCs, go to stored procedures?  Some rationale for when to use what?  Very
 interested in hearing your opinions!  Thanks.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352978
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Inline logic vs CFC vs SP

2012-10-23 Thread Russ Michaels

I think you are going to get varied responses here.

I have always been a fan of encapsulation even before CFC's and MVC, I
would put all DB queries into separate files and code into a separate file
and these would either be cfincluded or CF_tags.
Sure it does seem pointless sometimes to do this for a couple of lines of
code that wont be used elsewhere, but in the event someone does need to
change it one day, it is easier if it is easy to find for maintainability,
but then on the other hand if all files are named sensibly then everything
should be easy to find anyway regardless.
But if you are going to have standards and protocols, you should really
stick to them all the time and not just randomly break them.

StoredProcs should certainly be used if they provide a
worthwhile performance boost, only testing will tell you this. If there is
no real benefit then I would not use them just for the sake of it as it
adds unnecessary complexity to the maintainability especially where the
developer does not have access to the db server to edit the storedPROC.
It rather depends on your team, if you have a dedicated DBA who is a guru
at stored procs and performance tuning queries, then best to good use of
him. If it is the cfdevs writing the stored procs and they really have no
knowledge of how to tune them and optimise paging, indexes, execution plans
etc, then you are probably not gaining anything.

A framework is pretty ambiguous term, CFML is itself a framework, and if
you have a set of standards for separating display, business logic and
CRUDS, then you are are also creating a framework of sorts, more oft
referred to as a methodology.
Frameworks like ColdBox and Model-Glue are just taking it a step further by
doing everything for you, defining a set of rules, adding some event
handling and processing logic and a bunch of extra features and tools to
make life easier for you.



On Tue, Oct 23, 2012 at 2:55 PM, Shannon Rhodes shan...@rhodesedge.comwrote:


 I'm drafting our first set of code standards, and I'm running into a
 philosophical debate which I'd like to open up to the community.

 Some would say our standard should be to place all queries and as much
 execution logic as possible into CFCs.  The advantages of this are:  most
 of your business logic is centralized; if you have to make major changes
 (like the time we had to copy most of an app's functionality over but
 change a large percentage of the schema references) it's easy to find most
 of the relevant code; and, you can often make major changes to an
 application without pushing more than one or two files to production.

 Others argue that code only belongs in a CFC if we can expect that code to
 be reused.  So, if a piece of functionality is extremely specific, and
 therefore not likely to be called elsewhere, then why take the extra step
 of abstracting to an object.  The pet peeve illustrated here is a submit
 handler page that contains nothing but a call to a CFC, which apparently
 annoys when business logic is expected on the handler page.

 Still others would have us put most logic in stored procedures (which
 produces the sub-debate of whether it's redundant to call a CFC that calls
 a stored procedure).  First, I have to note that we are on Oracle, and
 personally I don't find it nearly as easy to debug stored procedures in
 Oracle as it is in SQL Server.  Second, I have heard that performance
 improvement is minimal, and security differences aren't noteworthy provided
 that you're using cfqueryparam.  Third, we would lose database portability
 (there has been talk of moving to SQL Server, which powers our SharePoint
 site; of course, there have also been rumblings of moving us to .Net in
 which case there's no particular advantage either way to storing business
 logic in the database layer versus the application layer).

 Then there are a couple of folks pushing for frameworks, but I don't think
 we're quite ready for that yet.

 So...inline code if reusability is unlikely?  Everything in CFCs?  Forget
 CFCs, go to stored procedures?  Some rationale for when to use what?  Very
 interested in hearing your opinions!  Thanks.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352980
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Inline logic vs CFC vs SP

2012-10-23 Thread Matt Quackenbush

I think the Mayans were right. The world _has to be_ ending in 2012,
because I am yet again agreeing completely with Russ Michaels!  :-)

Great post, Russ.

On Tue, Oct 23, 2012 at 9:42 AM, Russ Michaels r...@michaels.me.uk wrote:


 I think you are going to get varied responses here.

 I have always been a fan of encapsulation even before CFC's and MVC, I
 would put all DB queries into separate files and code into a separate file
 and these would either be cfincluded or CF_tags.
 Sure it does seem pointless sometimes to do this for a couple of lines of
 code that wont be used elsewhere, but in the event someone does need to
 change it one day, it is easier if it is easy to find for maintainability,
 but then on the other hand if all files are named sensibly then everything
 should be easy to find anyway regardless.
 But if you are going to have standards and protocols, you should really
 stick to them all the time and not just randomly break them.

 StoredProcs should certainly be used if they provide a
 worthwhile performance boost, only testing will tell you this. If there is
 no real benefit then I would not use them just for the sake of it as it
 adds unnecessary complexity to the maintainability especially where the
 developer does not have access to the db server to edit the storedPROC.
 It rather depends on your team, if you have a dedicated DBA who is a guru
 at stored procs and performance tuning queries, then best to good use of
 him. If it is the cfdevs writing the stored procs and they really have no
 knowledge of how to tune them and optimise paging, indexes, execution plans
 etc, then you are probably not gaining anything.

 A framework is pretty ambiguous term, CFML is itself a framework, and if
 you have a set of standards for separating display, business logic and
 CRUDS, then you are are also creating a framework of sorts, more oft
 referred to as a methodology.
 Frameworks like ColdBox and Model-Glue are just taking it a step further by
 doing everything for you, defining a set of rules, adding some event
 handling and processing logic and a bunch of extra features and tools to
 make life easier for you.



 On Tue, Oct 23, 2012 at 2:55 PM, Shannon Rhodes shan...@rhodesedge.com
 wrote:

 
  I'm drafting our first set of code standards, and I'm running into a
  philosophical debate which I'd like to open up to the community.
 
  Some would say our standard should be to place all queries and as much
  execution logic as possible into CFCs.  The advantages of this are:  most
  of your business logic is centralized; if you have to make major changes
  (like the time we had to copy most of an app's functionality over but
  change a large percentage of the schema references) it's easy to find
 most
  of the relevant code; and, you can often make major changes to an
  application without pushing more than one or two files to production.
 
  Others argue that code only belongs in a CFC if we can expect that code
 to
  be reused.  So, if a piece of functionality is extremely specific, and
  therefore not likely to be called elsewhere, then why take the extra step
  of abstracting to an object.  The pet peeve illustrated here is a submit
  handler page that contains nothing but a call to a CFC, which apparently
  annoys when business logic is expected on the handler page.
 
  Still others would have us put most logic in stored procedures (which
  produces the sub-debate of whether it's redundant to call a CFC that
 calls
  a stored procedure).  First, I have to note that we are on Oracle, and
  personally I don't find it nearly as easy to debug stored procedures in
  Oracle as it is in SQL Server.  Second, I have heard that performance
  improvement is minimal, and security differences aren't noteworthy
 provided
  that you're using cfqueryparam.  Third, we would lose database
 portability
  (there has been talk of moving to SQL Server, which powers our SharePoint
  site; of course, there have also been rumblings of moving us to .Net in
  which case there's no particular advantage either way to storing business
  logic in the database layer versus the application layer).
 
  Then there are a couple of folks pushing for frameworks, but I don't
 think
  we're quite ready for that yet.
 
  So...inline code if reusability is unlikely?  Everything in CFCs?  Forget
  CFCs, go to stored procedures?  Some rationale for when to use what?
  Very
  interested in hearing your opinions!  Thanks.
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352981
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Inline logic vs CFC vs SP

2012-10-23 Thread Russ Michaels

I knew that voodoo doll would come in handy :-)

On Tue, Oct 23, 2012 at 3:45 PM, Matt Quackenbush quackfu...@gmail.comwrote:


 I think the Mayans were right. The world _has to be_ ending in 2012,
 because I am yet again agreeing completely with Russ Michaels!  :-)

 Great post, Russ.

 On Tue, Oct 23, 2012 at 9:42 AM, Russ Michaels r...@michaels.me.uk
 wrote:

 
  I think you are going to get varied responses here.
 
  I have always been a fan of encapsulation even before CFC's and MVC, I
  would put all DB queries into separate files and code into a separate
 file
  and these would either be cfincluded or CF_tags.
  Sure it does seem pointless sometimes to do this for a couple of lines of
  code that wont be used elsewhere, but in the event someone does need to
  change it one day, it is easier if it is easy to find for
 maintainability,
  but then on the other hand if all files are named sensibly then
 everything
  should be easy to find anyway regardless.
  But if you are going to have standards and protocols, you should really
  stick to them all the time and not just randomly break them.
 
  StoredProcs should certainly be used if they provide a
  worthwhile performance boost, only testing will tell you this. If there
 is
  no real benefit then I would not use them just for the sake of it as it
  adds unnecessary complexity to the maintainability especially where the
  developer does not have access to the db server to edit the storedPROC.
  It rather depends on your team, if you have a dedicated DBA who is a guru
  at stored procs and performance tuning queries, then best to good use of
  him. If it is the cfdevs writing the stored procs and they really have no
  knowledge of how to tune them and optimise paging, indexes, execution
 plans
  etc, then you are probably not gaining anything.
 
  A framework is pretty ambiguous term, CFML is itself a framework, and if
  you have a set of standards for separating display, business logic and
  CRUDS, then you are are also creating a framework of sorts, more oft
  referred to as a methodology.
  Frameworks like ColdBox and Model-Glue are just taking it a step further
 by
  doing everything for you, defining a set of rules, adding some event
  handling and processing logic and a bunch of extra features and tools to
  make life easier for you.
 
 
 
  On Tue, Oct 23, 2012 at 2:55 PM, Shannon Rhodes shan...@rhodesedge.com
  wrote:
 
  
   I'm drafting our first set of code standards, and I'm running into a
   philosophical debate which I'd like to open up to the community.
  
   Some would say our standard should be to place all queries and as much
   execution logic as possible into CFCs.  The advantages of this are:
  most
   of your business logic is centralized; if you have to make major
 changes
   (like the time we had to copy most of an app's functionality over but
   change a large percentage of the schema references) it's easy to find
  most
   of the relevant code; and, you can often make major changes to an
   application without pushing more than one or two files to production.
  
   Others argue that code only belongs in a CFC if we can expect that code
  to
   be reused.  So, if a piece of functionality is extremely specific, and
   therefore not likely to be called elsewhere, then why take the extra
 step
   of abstracting to an object.  The pet peeve illustrated here is a
 submit
   handler page that contains nothing but a call to a CFC, which
 apparently
   annoys when business logic is expected on the handler page.
  
   Still others would have us put most logic in stored procedures (which
   produces the sub-debate of whether it's redundant to call a CFC that
  calls
   a stored procedure).  First, I have to note that we are on Oracle, and
   personally I don't find it nearly as easy to debug stored procedures in
   Oracle as it is in SQL Server.  Second, I have heard that performance
   improvement is minimal, and security differences aren't noteworthy
  provided
   that you're using cfqueryparam.  Third, we would lose database
  portability
   (there has been talk of moving to SQL Server, which powers our
 SharePoint
   site; of course, there have also been rumblings of moving us to .Net in
   which case there's no particular advantage either way to storing
 business
   logic in the database layer versus the application layer).
  
   Then there are a couple of folks pushing for frameworks, but I don't
  think
   we're quite ready for that yet.
  
   So...inline code if reusability is unlikely?  Everything in CFCs?
  Forget
   CFCs, go to stored procedures?  Some rationale for when to use what?
   Very
   interested in hearing your opinions!  Thanks.
  
  
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352983

Re: Inline logic vs CFC vs SP

2012-10-23 Thread Matt Quackenbush

Heh. :-)

On Tue, Oct 23, 2012 at 9:51 AM, Russ Michaels r...@michaels.me.uk wrote:


 I knew that voodoo doll would come in handy :-)

 On Tue, Oct 23, 2012 at 3:45 PM, Matt Quackenbush quackfu...@gmail.com
 wrote:

 
  I think the Mayans were right. The world _has to be_ ending in 2012,
  because I am yet again agreeing completely with Russ Michaels!  :-)
 
  Great post, Russ.
 
  On Tue, Oct 23, 2012 at 9:42 AM, Russ Michaels r...@michaels.me.uk
  wrote:
 
  
   I think you are going to get varied responses here.
  
   I have always been a fan of encapsulation even before CFC's and MVC, I
   would put all DB queries into separate files and code into a separate
  file
   and these would either be cfincluded or CF_tags.
   Sure it does seem pointless sometimes to do this for a couple of lines
 of
   code that wont be used elsewhere, but in the event someone does need to
   change it one day, it is easier if it is easy to find for
  maintainability,
   but then on the other hand if all files are named sensibly then
  everything
   should be easy to find anyway regardless.
   But if you are going to have standards and protocols, you should really
   stick to them all the time and not just randomly break them.
  
   StoredProcs should certainly be used if they provide a
   worthwhile performance boost, only testing will tell you this. If there
  is
   no real benefit then I would not use them just for the sake of it as it
   adds unnecessary complexity to the maintainability especially where the
   developer does not have access to the db server to edit the storedPROC.
   It rather depends on your team, if you have a dedicated DBA who is a
 guru
   at stored procs and performance tuning queries, then best to good use
 of
   him. If it is the cfdevs writing the stored procs and they really have
 no
   knowledge of how to tune them and optimise paging, indexes, execution
  plans
   etc, then you are probably not gaining anything.
  
   A framework is pretty ambiguous term, CFML is itself a framework, and
 if
   you have a set of standards for separating display, business logic and
   CRUDS, then you are are also creating a framework of sorts, more oft
   referred to as a methodology.
   Frameworks like ColdBox and Model-Glue are just taking it a step
 further
  by
   doing everything for you, defining a set of rules, adding some event
   handling and processing logic and a bunch of extra features and tools
 to
   make life easier for you.
  
  
  
   On Tue, Oct 23, 2012 at 2:55 PM, Shannon Rhodes 
 shan...@rhodesedge.com
   wrote:
  
   
I'm drafting our first set of code standards, and I'm running into a
philosophical debate which I'd like to open up to the community.
   
Some would say our standard should be to place all queries and as
 much
execution logic as possible into CFCs.  The advantages of this are:
   most
of your business logic is centralized; if you have to make major
  changes
(like the time we had to copy most of an app's functionality over but
change a large percentage of the schema references) it's easy to find
   most
of the relevant code; and, you can often make major changes to an
application without pushing more than one or two files to production.
   
Others argue that code only belongs in a CFC if we can expect that
 code
   to
be reused.  So, if a piece of functionality is extremely specific,
 and
therefore not likely to be called elsewhere, then why take the extra
  step
of abstracting to an object.  The pet peeve illustrated here is a
  submit
handler page that contains nothing but a call to a CFC, which
  apparently
annoys when business logic is expected on the handler page.
   
Still others would have us put most logic in stored procedures (which
produces the sub-debate of whether it's redundant to call a CFC that
   calls
a stored procedure).  First, I have to note that we are on Oracle,
 and
personally I don't find it nearly as easy to debug stored procedures
 in
Oracle as it is in SQL Server.  Second, I have heard that performance
improvement is minimal, and security differences aren't noteworthy
   provided
that you're using cfqueryparam.  Third, we would lose database
   portability
(there has been talk of moving to SQL Server, which powers our
  SharePoint
site; of course, there have also been rumblings of moving us to .Net
 in
which case there's no particular advantage either way to storing
  business
logic in the database layer versus the application layer).
   
Then there are a couple of folks pushing for frameworks, but I don't
   think
we're quite ready for that yet.
   
So...inline code if reusability is unlikely?  Everything in CFCs?
   Forget
CFCs, go to stored procedures?  Some rationale for when to use what?
Very
interested in hearing your opinions!  Thanks

Re: Inline logic vs CFC vs SP

2012-10-23 Thread Gerald Guido


 If there is
 no real benefit then I would not use them just for the sake of it as it
 adds unnecessary complexity to the maintainability especially where the
 developer does not have access to the db server to edit the storedPROC.



1++
I can attest to this. I work with apps where *everything* are in SP's and
they are a total PITA maintenance wise. Any changes to the database have to
be changed in two (or often more) places. Every try to hunt down instances
of a table or column in a slew of SP's? No fun at all. I have had some
changes that would normally take an hour or two turn into all day affairs.
So I am with Matt, not a fan of stored procedures. They have their place
but often just add needless complexity.

I am also partial to the black box approach when dealing with data. I am
also a big fan of machine generated code for CRUDs, service layers, ORM's
and the like. It should not matter where the data comes from. When done
right, you could swap out your entire data layer from a database to web
services and the rest of your app would be none the wiser. Again, like Matt
said. Portability.

My $0.02 and worth every penny.

G!

On Tue, Oct 23, 2012 at 10:42 AM, Russ Michaels r...@michaels.me.uk wrote:


 I think you are going to get varied responses here.

 I have always been a fan of encapsulation even before CFC's and MVC, I
 would put all DB queries into separate files and code into a separate file
 and these would either be cfincluded or CF_tags.
 Sure it does seem pointless sometimes to do this for a couple of lines of
 code that wont be used elsewhere, but in the event someone does need to
 change it one day, it is easier if it is easy to find for maintainability,
 but then on the other hand if all files are named sensibly then everything
 should be easy to find anyway regardless.
 But if you are going to have standards and protocols, you should really
 stick to them all the time and not just randomly break them.

 StoredProcs should certainly be used if they provide a
 worthwhile performance boost, only testing will tell you this. If there is
 no real benefit then I would not use them just for the sake of it as it
 adds unnecessary complexity to the maintainability especially where the
 developer does not have access to the db server to edit the storedPROC.
 It rather depends on your team, if you have a dedicated DBA who is a guru
 at stored procs and performance tuning queries, then best to good use of
 him. If it is the cfdevs writing the stored procs and they really have no
 knowledge of how to tune them and optimise paging, indexes, execution plans
 etc, then you are probably not gaining anything.

 A framework is pretty ambiguous term, CFML is itself a framework, and if
 you have a set of standards for separating display, business logic and
 CRUDS, then you are are also creating a framework of sorts, more oft
 referred to as a methodology.
 Frameworks like ColdBox and Model-Glue are just taking it a step further by
 doing everything for you, defining a set of rules, adding some event
 handling and processing logic and a bunch of extra features and tools to
 make life easier for you.



 On Tue, Oct 23, 2012 at 2:55 PM, Shannon Rhodes shan...@rhodesedge.com
 wrote:

 
  I'm drafting our first set of code standards, and I'm running into a
  philosophical debate which I'd like to open up to the community.
 
  Some would say our standard should be to place all queries and as much
  execution logic as possible into CFCs.  The advantages of this are:  most
  of your business logic is centralized; if you have to make major changes
  (like the time we had to copy most of an app's functionality over but
  change a large percentage of the schema references) it's easy to find
 most
  of the relevant code; and, you can often make major changes to an
  application without pushing more than one or two files to production.
 
  Others argue that code only belongs in a CFC if we can expect that code
 to
  be reused.  So, if a piece of functionality is extremely specific, and
  therefore not likely to be called elsewhere, then why take the extra step
  of abstracting to an object.  The pet peeve illustrated here is a submit
  handler page that contains nothing but a call to a CFC, which apparently
  annoys when business logic is expected on the handler page.
 
  Still others would have us put most logic in stored procedures (which
  produces the sub-debate of whether it's redundant to call a CFC that
 calls
  a stored procedure).  First, I have to note that we are on Oracle, and
  personally I don't find it nearly as easy to debug stored procedures in
  Oracle as it is in SQL Server.  Second, I have heard that performance
  improvement is minimal, and security differences aren't noteworthy
 provided
  that you're using cfqueryparam.  Third, we would lose database
 portability
  (there has been talk of moving to SQL Server, which powers our SharePoint
  site; of course, there have also been rumblings

Re: Inline logic vs CFC vs SP

2012-10-23 Thread Maureen

I put all interaction with the database in CFCs, with each action happening
once so that the same result always comes back regardless of where  the
logic for the database activity is needed.  If you write, test and debug
these CFCs as an early step in your project, downstream development that
uses them becomes much more efficient. Once your CFCs are written and
tested all programmers should be required to use them.  It saves much time
and trouble if everyone is interacting with the database exactly the same.

I use one CFC for each data table, with the same name as the table. It
includes all the selects, gets, sets, puts and initialization for the
object.  If the data table contains foreign key fields, I will do a select
in the CFC that joins the foreign key to the appropriate table and returns
all the information necessary for display in a structure.

Each CFC extends  DATAMANAGER.CFC which is a custom CFC that controls the
DSN being used, confirms permissions, cleans data being sent to the
database to trap any hacker attacks, manages failed transactions,  logs the
result of any catch-try failures, etc.  This allows all my error management
and logging to happen in one place.

I only use stored procedures for complex database interactions or handling
massive amounts of data  that will run faster on the database than doing
the calculation and logic with CFML, and I call them from the CFC for the
related table so that I can use the DATAMANAGER.CFC as above.  Again, this
allows me to have total control over the call to the database, and always
returns the same result regardless of where the stored proc is needed in
the business or display logic.

I never put queries in CFM pages or any display pages because I want the
code where I can find it readily and if the database changes I only have to
make those changes in one place. Frankly I just don't think database
interaction belongs with the business and display logic.  I do occasionally
put a query of queries in CFM pages to re-sort or sub-select data items for
display.

On Tue, Oct 23, 2012 at 6:55 AM, Shannon Rhodes shan...@rhodesedge.comwrote:


 I'm drafting our first set of code standards, and I'm running into a
 philosophical debate which I'd like to open up to the community.


...(snip)


 So...inline code if reusability is unlikely?  Everything in CFCs?  Forget
 CFCs, go to stored procedures?  Some rationale for when to use what?  Very
 interested in hearing your opinions!  Thanks.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352986
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Webservice returning CFC in a different directory

2012-08-02 Thread Les Schmidt

I know this post is over 8 years old, but it is the only one that was on 
point to a problem I was having.  I now have a solution so am simply updating 
this in case others stumble upon the same situation. I'm on Coldfusion 9.

My set up is exactly like the original poster's:  webservices in a directory 
under the webroot, components in a directory outside the webroot of the current 
app.

I was getting the same as errors described above. 

What I discovered - after much hair pulling! - was that I had carefully (I 
thought) sculpted a extremely limited subset of the main application.cfc (being 
overly cautious perhaps) and placed it in the web services directory.  In 
CFAdmin, the order for reading application.cfcs was set to default order.  
Accordingly it was reading the application.cfc in the web services directory.

I also put all my mappings in the application.cfc (vs. manage them in the 
CFAdminstrator).

Well, in my vast wisdom, I discovered that I had excised the mapping to the 
components directory in the web services version of application.cfc.  Once I 
added that back in, I was in heaven.  The components lived outside the app and 
functioned beautifully with the CFCs in the web services directory.

Hope this helps the next soul that stumbles upon this problem. 


*   Have
you tried downing your instance and blowing away the contents of both
your cfclasses and cfc-skeletons directories.

 

Yup - tried it many times, no luck... 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352048
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFC Oddity

2012-07-16 Thread Raymond Camden

In ColdFusion 10, I can't reproduce this at all. I _never_ see cookies
in the response. However, I see nothing 'wrong' in this. The same
cookie values are sent from the client to the server, and server-side
values are persisted. So when I do...

if(!structkeyexists(client, x)) client.x=1;
writelog(client is #client.x#);
client.x++;

everything is kosher.

On Fri, Jul 13, 2012 at 3:19 PM, Alan Rother alan.rot...@gmail.com wrote:

 Sure,

 For the record, it's not any one method, I've tried it with numerous
 functions and the example below was just the simplest unused method in this
 CFC

 cffunction name=Logout_User access=remote output=true
 returntype=any

 cfset var foo = 

 !--- Check if user is stored in client ---
 cfif StructKeyExists(client, userID)
 cfset delete = DeleteClientVariable(userID)
 cfset delete = DeleteClientVariable(userAgentUUID)
 cfset delete = DeleteClientVariable(userAgentInstanceUUID)
 /cfif

 cfreturn foo/
 /cffunction


 If I remove the foo from the cfreturn - then CF passes the set-cookie
 request back in the repnse header - it's it's there, even if, as in the
 example, it's blank - it still won't give me the set-cookie

 Here is my jQuery as well

 function getGarbageCFC(){
 $.get('/mobile/com/UserManager.cfc?method=Logout_User',
 function(data) {
 //console.log(data);
 });

 }

 If I put a literal CFCOOKIE tag into the method, it does send it in the
 headers - but only the cookie I set manually - not the other CF cookies



 This is my FF FireBux header dump on the reponse when I don't have foo in
 the cfreturn

 ConnectionKeep-AliveContent-Typetext/html; charset=UTF-8DateFri, 13 Jul
 2012 20:17:43 GMTKeep-Alivetimeout=5, max=100ServerServer/4Set-Cookie
 CFGLOBALS=urltoken%3DCFID%23%3D195351%26CFTOKEN%23%3De9a3908e9cb4675%2D0E71EA23%2D9137%2D949F%2D2834E7E6CDA837C5
 %23lastvisit%3D%7Bts%20%272012%2D07%2D13%2013%3A17%3A44%27%7D%23timecreated%3D%7Bts%20%272012%2D07%2D13
 %2010%3A45%3A13%27%7D%23hitcount%3D27%23cftoken%3De9a3908e9cb4675%2D0E71EA23%2D9137%2D949F%2D2834E7E6CDA837C5%23cfid%3D195351%23;expires=Sun,
 06-Jul-2042 20:17:44 GMT;path=/

 This is the result from the exact same request when I do have foo in the
 cfreturn

 ConnectionKeep-AliveContent-Typetext/html; charset=UTF-8DateFri, 13 Jul
 2012 18:56:57 GMTKeep-Alivetimeout=5,
 max=100ServerServer/4Set-CookieALAN=Awesome;expires=Sun,
 06-Jul-2042 18:56:57 GMT;path=/Transfer-Encodingchunked

 Thoughts?

 --
 Alan Rother
 Manager, Phoenix Cold Fusion User Group, www.AZCFUG.org
 Twitter: @AlanRother


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351902
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


  1   2   3   4   5   6   7   8   9   10   >