Certain JavaScript in an offline form/task submission in Drafts or the Outbox will not work

February 23, 2018 | KB: 1013847
Laserfiche App 10.2

Summary

Certain JavaScript in an offline form/task submission will not work from Drafts or the Outbox. For example, you open an offline form, begin to fill it out, and save it as a draft. When you open the draft to complete and submit it, the JavaScript trigger event will not run successfully.

Cause

The Javascript needs to be customized in Forms for the code to run successfully.

Resolution

If your form contains the following custom Javascript:

    $(document).ready(function () {
    MyFunction();
    });

update it to this new Javascript:

    $(document).ready(function () {
    var oldFormInit = formInit;
    formInit = function () {
    oldFormInit();
    MyFunction();
    }
    MyFunction();
    });


If your form contains the following custom event object:

    $(document).on('_some_event',_some_handler_)

update it to this new Javascript:

    $(document).ready(function () {
    var oldFormInit = formInit;
    var theEvent = event;

    formInit = function () {
    if(event==null){
    event= theEvent;
    }
    $(document).off('_some_event');

    oldFormInit();
    MyFunction();
    }
    MyFunction();
    });

Related Links

1013811 Release Notes for the Laserfiche 10.2 App.