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 <[email protected]>wrote:

>
> 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 <[email protected]
> >wrote:
>
> >
> > Hey, Ray, and thanks for the reply...
> >
> > Here's the ajax part...
> >
> > $.ajax     ({ cache:          false,
> >   type:            'post',
> >   url:
> >
> >
> 'email-newsletter.cfc?method=mProcessEmailNewsletterForm&returnFormat=json',
> >   data:            values,
> >   success:      function(result) {
> >
> >   alert('Success!');
> >
> >   }
> >
> >
> > On Wed, Jan 15, 2014 at 4:03 PM, Raymond Camden <[email protected]
> > >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 <
> > [email protected]
> > > >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

Reply via email to