Re: Using cfargumentCollection with cfajaxproxy

2008-08-23 Thread Charlie Griefer
On Fri, Aug 22, 2008 at 11:11 PM, Lisa Lee <[EMAIL PROTECTED]> wrote:

> I used cfajaxproxy to create a JavaScript method, like so:
>  jsclassname="accountManager">
>
> Then, within a  block, I have the following:
> var am = new accountManager();
> am.setCallbackHandler(showUpdate);
> am.setErrorHandler(myErrorHandler);
> am.updatePerson(1,"Doe","John");
>
> My InternalAccountManagement.cfc has a function named, of course,
> updatePerson, and it takes three arguments:  personID, lastName, and
> firstName (declared in that order in the method).  What I'd really like to
> do in my JavaScript block above is to take advantage of ColdFusion's
> argumentCollection parameter, and pass 1, "Doe," and "John" within one
> argumentCollection, rather than passing them as three separate values in the
> am.updatePerson call.  Is this possible?
>

well, you won't be able to use argumentCollection, because that's for cf
variables, and what you're dealing with is JS variables.  the closest that
i've been able to come is to pass the data as a JSON object, and have the
CFC method expect a single argument, rather than 3.  I originally had all 3
cfarguments explicitly stated, but the method apparently doesn't
'deconstruct' the argument.  it saw the JSON object as the first argument
(personID), and the other two (lastName and firstName) were null.

if you're ok with the method accepting a single argument, something like
this should work:

your .cfm file: