Page 1 of 1

[RDMLX]Hooking OnAction

Posted: Fri Apr 15, 2016 7:22 pm
by MegumiSawada
Hi,

Is it possible to detect Action Name when hooking on Action by Form.OnAction?

I've set local operation AAAA to the command of an offline formviews and its action is set to 'AAAA'.
It seems I can write #COM_OWNER.Set_OP_ExecScript Event('/Form.OnAction') but not #COM_OWNER.Set_OP_ExecScript Event('/Form.OnAction.AAAA') .
When I tap AAAA command, error message says "Unable to find local form with the specified name 'AAAA' Please ensure the name is correct and the form with that symbolic name exists."

Best Regards,
Megumi Sawada

Re: [RDMLX]Hooking OnAction

Posted: Mon Apr 18, 2016 7:47 am
by tsupartono
Megumi,
You can't do Form.Action.AAAA as that is not a valid form (OnAction expects an operation).
You'd need to set the Form.OnAction to your ExecScript operation.
Then inside your JavaScript ECL, you'd check what action was invoked.
LongRange assigns the invoked action to the "action" form variable, so you'd need to get the value of this variable, using q_receiveVars function.
Please see the code example below:

Code: Select all

lrexec(
function()
{
   q_receiveVars("action");
},
function()
{
   // Requested variables are now available in the current "this" context
   // To access the "action" variable, we can say "this.action"
   var myAction = this.action;
}
. . .