Create Action Handlers for User Actions
The form provides Submit, Close, and Cancel actions, which are displayed to the user as buttons.
Handlers for these actions are added using the Runtime Forms Adapter setActionHandler method. The handlers are added once the form is successfully initialized, via the formLoadSuccessCallback function.
var cancelHandler = function(actionName, form) { var jsonPayload = "nodata"; // document.getElementById('jsonpayload').value = jsonPayload; submitData("cancelworkitem", jsonPayload); form.destroy(); }; var closeHandler = function(actionName, form) { var jsonPayload = form.getSerializedParameters(); document.getElementById('jsonpayload').value = jsonPayload; submitData("closeworkitem", jsonPayload); form.destroy(); }; var submitHandler = function(actionName, form) { var jsonPayload = form.getSerializedParameters(); document.getElementById('jsonpayload').value = jsonPayload; submitData("completeworkitem",jsonPayload); form.destroy(); }; var formLoadSuccessCallback = function(form) { form.setActionHandler(form.ACTION_CANCEL, cancelHandler); form.setActionHandler(form.ACTION_CLOSE, closeHandler); form.setActionHandler(form.ACTION_SUBMIT, submitHandler); }; var formLoadErrorCallback = function(error) { alert('Form load failed with error: ' + error); }; |
When the user performs an action by clicking a button, the handler calls an appropriate method to process the action.
Copyright © Cloud Software Group, Inc. All rights reserved.