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

Reply via email to