surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.12k stars 802 forks source link

The navigateToUrl redirection occurs before the data sending operation completes within the survey.onComplete function #8310

Closed JaneSjs closed 4 months ago

JaneSjs commented 4 months ago

Updated The followng code should be used:

    survey.onComplete.add(async (sender, options) => {
       //Show the saving message and tell survey model to wait with navigation
        options.showSaveInProgress()
        await upload(sender).then(() => {
             //Show message about the success and tell survey that it can navigation now
            options.showSaveSuccess();
        });
    }); 

The original code doesn't provide any information when the saving is over:

    survey.onComplete.add(async (sender, options) => {
        await upload(sender);
    }); 

T18274 - "Redirect to an external link after submission" does not wait for response upload https://surveyjs.answerdesk.io/internal/ticket/details/T18274