MScriptAction

Top  Previous  Next

MScriptAction

Sometimes it is required that a couple of MScript functions are executed on the server without a need for refreshing through a data source. For such cases this action can be used.

MScriptAction_pe

Properties

MScript (mscript)

The MScript functions to execute on the server.

 
Request Parameters (requestParams)

The parameters and their values. The initial value "{p1:'p1val', p2:'p2val'} ?" aims to show the definition syntax and if no update is made to it, it is ignored in the output.

When defining this property, it is important in which element the generated call definition is used. For example the this word in "{ID:this.value}" definition represents the HTML element object that the generated call definition is used in, not this action element itself.
 

CallBack Function (callbackFunc)

The Javascript function to be called after the MScript functions are executed on the server and the and the response is received. The function receives a MultiPartAjaxResponse object as the parameter

 

User Data (userData)

The user data object defined with this property is passed to the response handler and the callback function.

 

Error Handler (errorHandler)

The name of the function to be called when an error occurs. The function receives Exception and AjaxResponse objects as the parameters.

 

The calling the AjaxMgr.executeMScript() function

 

Dynamic Call Definition
 
On the context menu that pops up when an action element is right clicked, the following options are displayed. If the option 'Copy "Dynamic Call Definition" to Clipboard' is selected, a dynamic call definition is formed and copied to the Windows clipboard.

 

DynamicCallDefinition

 

The copied definition can later be pasted into the event properties of the elements or into the "Embedded Script" properties of the Script elements.
 
Example:
 

%vof(/myMScriptAction/jscall)

 

The actual AjaxMgr.executeMScript() call is generated during the compiling of the page by expanding the %vof(??/jscall) definition.

 

 

Function Call

 

The second "Copy to clipboard" option on the context menu is used for that. When the 'Copy "Javascript Function Call" to Clipboard' option is selected, AjaxMgr.executeMScript() call definition is formed immediately with the current values of the properties and copied to the Windows clipboard.

 

The call definition copied to the clipboard can later be pasted into the event properties of the elements or into the "Embedded Script" properties of the Script elements.

 

Example:

 

 

AjaxMgr.executeMScript({

 

  actionName       : 'myMScriptAction'

  ,requestParams   : {SCART_ID:this.value}

  ,callbackFunc    : checkStatus

  ,errorHandler    : myErrorHandler

  

})

 

 

Warning! In contrary to the dynamic call definition, the changes made to the properties after the function call copied, will not be effective.