16. Editor: Field is still processing

If attempting to submit a form when a field for the whole form is in a processing state, Editor will not submit the from. This is to allow the processing to complete and ensure data integrity.

The error:

Field is still processing

will occur when the form or a field in the form is in a processing state when attempting to submit the form.

Meaning

If Editor detects that a field is in a "processing" state (field().processing()) it suggests that there is still data to update in the form (possibly from an Ajax calculation) and therefore the form should not submit. Editor will cancel the submission and wait for the processing to complete.

Resolution

The most common reason for this problem is using dependent() and forgetting to return an object for Editor to process or not using its callback function. For example:

editor.dependent('myField', function () {
    editor.field('otherField').val(1);
});

will never complete. It should be either:

editor.dependent('myField', function () {
    editor.field('otherField').val(1);

    return {};
});

or

editor.dependent('myField', function () {
    return {
        values: {
            otherField: 1
        }
    };
});

Equally if using an async behaviour such as Ajax you need to make a call to the callback function to let Editor know that the processing action is finished:

editor.dependent('myField', function(val, data, cb) {
    $.ajax({
        url: '/api/dependent',
        data: data,
        success: function (json) {
            cb(json);
        }
    })
});