0

Error:

Accessing the 'caller' property of a function or arguments object is not allowed in strict mode

On the click of the same button action, I am starting some workflows and at the end, I am trying to submit the form by triggering the OnKeyPress event. This error surfaces only in IE11 and edge. It works just fine in Chrome.

Button:

<input type="button" value="Resubmit" name="SubmitBack" Class="btn btn-primary" id="resubmit" style="display:none" onkeypress="javascript:{ddwrt:GenFireServerEvent('__commit;__redirect={*redirectionurl*}')}"  ></input>

Script for OnClick function from which I am triggering OnKeyPress:

setTimeout(function() {
            subId = '8551c477-e9ac-4aab-a012-5e92f7c44ca2';          

            startWorkflow(itemId, subId).then(function() {


                setTimeout(function() {
                    $('#resubmit').keypress();
                }, 7000);
                deffered.resolve();
                return true;

            }, function() {
                deffered.reject();
            });
        }, 2000);
    });
1

Try to add line of code below before OnKeyPress event.

'use strict';

If you want to start a workflow before submit the form, I suggest you use REST API + jQuery Ajax to achieve it. To make the request synchronization, we can set async:false in the Ajax call. Then execute the OnkeyPress event or submit the form using REST API.

More information: http://www.c-sharpcorner.com/article/how-to-trigger-sharepoint-2013-designer-workflow-on-a-list-item-by-calling-rest/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.