Welcome Guest Search | Active Topics | Sign In | Register

Callback with multiple parameters using client-side javascript Options
Grant Szabo
Posted: Tuesday, October 4, 2011 4:47:12 PM
Rank: Newbie
Groups: Member

Joined: 1/4/2011
Posts: 6
I am trying out the Callback control for the first time. I need to use client-side javascript to trigger the server-side call. The documentation states that I am to use the following syntax: eo_Callback('Callback1', inputParam);

However, I have 3 input parameters that need to be passed in, not one. Is this supported? How do I implement?
eo_support
Posted: Tuesday, October 4, 2011 5:07:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can not pass multiple values to eo_Callback directly. The easiest way is to use the ScriptEvent control together with the CallbackPanel control. You would need to:

1. Place a ScriptEvent control in the page;
2. Edit the CallbackPanel's Triggers property to set the ScriptEvent control as a trigger of the CallbackPanel control;
3. When you need to raise a callback, call eo_TriggerServerEvent instead of eo_Callback:

http://doc.essentialobjects.com/library/1/jsdoc.public.global.eo_triggerserverevent.aspx

You can pass an array as commandArgs for this function. For example:

Code: JavaScript
//Pass an array with two elements "one" and "two"
eo_TriggerServerEvent("ScriptEvent1", "anything", ["one", "two"]);


4. Handle the ScriptEvent's Command event. You will find the arguments you passed in in the event' CommandArgument property.

The key is you will need to set the ScriptEvent as the CallbackPanel's trigger. That way the CallbackPanel will intercept the ScriptEvent's Command event. Otherwise a full post back occurs.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.