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: 

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