CFAJAX: Passing multiple parameters to function

View: New views
6 Messages — Rating Filter:   Alert me  

CFAJAX: Passing multiple parameters to function

by Josh Nathanson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just getting into CFAjax and loving it.  Got a question about passing
multiple parameters to the CF function in the DWREngine._execute call - how
do you do it?  I'm doing this:

function doSearch()
   {
    var _priceRange = DWRUtil.getValue("priceRange");
    var _searchText = DWRUtil.getValue("searchText");
    DWREngine._execute(_cfscriptLocation, null, 'getProducts', [
_priceRange, _searchText ], searchResult);
   }

Trying to send the variables _priceRange and _searchText to the cffunction
'getProducts' but it doesn't seem to work.  Is there a way to do this?  TIA

-- Josh



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2337
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: CFAJAX: Passing multiple parameters to function

by Todd Kingham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have you tried passing it as an object?

That is how it works in JSMX. You just build it up and pass the entire
object to the server like this:

params = new Object();
params._priceRange = 'foo';
params._searchText = 'foo';

http( 'post' , 'myComponent.cfc?method=doSomthing' , myCallback , params );

Perhaps CFAJAX allows the same type of thing?


-----Original Message-----
From: Josh Nathanson [mailto:pc@...]
Sent: Thursday, March 16, 2006 1:34 PM
To: Ajax
Subject: CFAJAX: Passing multiple parameters to function

Just getting into CFAjax and loving it.  Got a question about passing
multiple parameters to the CF function in the DWREngine._execute call - how
do you do it?  I'm doing this:

function doSearch()
   {
    var _priceRange = DWRUtil.getValue("priceRange");
    var _searchText = DWRUtil.getValue("searchText");
    DWREngine._execute(_cfscriptLocation, null, 'getProducts', [
_priceRange, _searchText ], searchResult);
   }

Trying to send the variables _priceRange and _searchText to the cffunction
'getProducts' but it doesn't seem to work.  Is there a way to do this?  TIA

-- Josh





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2338
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: CFAJAX: Passing multiple parameters to function

by Josh Nathanson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Todd, I'll give that a go.

-- Josh


----- Original Message -----
From: "Todd Kingham" <todd@...>
To: "Ajax" <ajax@...>
Sent: Thursday, March 16, 2006 12:55 PM
Subject: RE: CFAJAX: Passing multiple parameters to function


> Have you tried passing it as an object?
>
> That is how it works in JSMX. You just build it up and pass the entire
> object to the server like this:
>
> params = new Object();
> params._priceRange = 'foo';
> params._searchText = 'foo';
>
> http( 'post' , 'myComponent.cfc?method=doSomthing' , myCallback ,
> params );
>
> Perhaps CFAJAX allows the same type of thing?
>
>
> -----Original Message-----
> From: Josh Nathanson [mailto:pc@...]
> Sent: Thursday, March 16, 2006 1:34 PM
> To: Ajax
> Subject: CFAJAX: Passing multiple parameters to function
>
> Just getting into CFAjax and loving it.  Got a question about passing
> multiple parameters to the CF function in the DWREngine._execute call -
> how
> do you do it?  I'm doing this:
>
> function doSearch()
>   {
>    var _priceRange = DWRUtil.getValue("priceRange");
>    var _searchText = DWRUtil.getValue("searchText");
>    DWREngine._execute(_cfscriptLocation, null, 'getProducts', [
> _priceRange, _searchText ], searchResult);
>   }
>
> Trying to send the variables _priceRange and _searchText to the cffunction
> 'getProducts' but it doesn't seem to work.  Is there a way to do this?
> TIA
>
> -- Josh
>
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2339
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: CFAJAX: Passing multiple parameters to function

by Josh Nathanson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Got it working, but not passing the params as an object - had to build a
param string, then parse the string as a list in CF using ListGetAt.  I
noticed all the cfajax examples pass a single string argument so I presume
that's the only type of argument that will work.  If anyone knows different
let me know.

-- Josh




----- Original Message -----
From: "Todd Kingham" <todd@...>
To: "Ajax" <ajax@...>
Sent: Thursday, March 16, 2006 12:55 PM
Subject: RE: CFAJAX: Passing multiple parameters to function


> Have you tried passing it as an object?
>
> That is how it works in JSMX. You just build it up and pass the entire
> object to the server like this:
>
> params = new Object();
> params._priceRange = 'foo';
> params._searchText = 'foo';
>
> http( 'post' , 'myComponent.cfc?method=doSomthing' , myCallback ,
> params );
>
> Perhaps CFAJAX allows the same type of thing?
>
>
> -----Original Message-----
> From: Josh Nathanson [mailto:pc@...]
> Sent: Thursday, March 16, 2006 1:34 PM
> To: Ajax
> Subject: CFAJAX: Passing multiple parameters to function
>
> Just getting into CFAjax and loving it.  Got a question about passing
> multiple parameters to the CF function in the DWREngine._execute call -
> how
> do you do it?  I'm doing this:
>
> function doSearch()
>   {
>    var _priceRange = DWRUtil.getValue("priceRange");
>    var _searchText = DWRUtil.getValue("searchText");
>    DWREngine._execute(_cfscriptLocation, null, 'getProducts', [
> _priceRange, _searchText ], searchResult);
>   }
>
> Trying to send the variables _priceRange and _searchText to the cffunction
> 'getProducts' but it doesn't seem to work.  Is there a way to do this?
> TIA
>
> -- Josh
>
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2340
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: CFAJAX: Passing multiple parameters to function

by James Holmes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is all descibed in the wiki - you just pass the multiple
arguments on the calling line:

http://www.indiankey.com/cfajax/wiki/ow.asp?CFAjaxCallSyntax

On 3/17/06, Josh Nathanson <pc@...> wrote:
> Got it working, but not passing the params as an object - had to build a
> param string, then parse the string as a list in CF using ListGetAt.  I
> noticed all the cfajax examples pass a single string argument so I presume
> that's the only type of argument that will work.  If anyone knows different
> let me know.

--
CFAJAX docs and other useful articles:
http://jr-holmes.coldfusionjournal.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2341
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: CFAJAX: Passing multiple parameters to function

by Josh Nathanson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool thanks, that makes things easier.  Will check the Wiki first next time.

-- Josh



----- Original Message -----
From: "James Holmes" <james.holmes@...>
To: "Ajax" <ajax@...>
Sent: Thursday, March 16, 2006 3:49 PM
Subject: Re: CFAJAX: Passing multiple parameters to function


> This is all descibed in the wiki - you just pass the multiple
> arguments on the calling line:
>
> http://www.indiankey.com/cfajax/wiki/ow.asp?CFAjaxCallSyntax
>
> On 3/17/06, Josh Nathanson <pc@...> wrote:
>> Got it working, but not passing the params as an object - had to build a
>> param string, then parse the string as a list in CF using ListGetAt.  I
>> noticed all the cfajax examples pass a single string argument so I
>> presume
>> that's the only type of argument that will work.  If anyone knows
>> different
>> let me know.
>
> --
> CFAJAX docs and other useful articles:
> http://jr-holmes.coldfusionjournal.com/
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:47:2342
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54