my requirement is after clicking complete button the form & if API fails i want to stay on the same page.
We have closed this ticket because another page addresses its subject:
Retry after options.showDataSavingError()We have closed this ticket because another page addresses its subject:
Retry after options.showDataSavingError()my requirement is after clicking complete button the form & if API fails i want to stay on the same page.
Hello Amala,
Please refer to this ticket.
Thank you,
Andrew
SurveyJS Team
it's not working for me.
Could you please create an example that doesn't work? It is hard to help if we do not see the issue.
Thank you,
Andrew
SurveyJS Team
On survey.oncomplete function called an API to submit the data ,when the API fails I have to stay on the same page instead of going to the thank u page.
xhr.onload = xhr.onerror = function () {
// Process our return data
if (xhr.status >= 200 && xhr.status < 300) {
console.log(xhr.responseText);
} else {
options.showDataSavingError();
alert("Submit failed. Please verify data & try again.")
})
}
}
You can see the following code in the example in the ticket I posted:
options.showDataSavingError(); setTimeout(() => { //go to the running mode without resetting data and the current page survey.clear(false, false); }, 1000);
After delay in a second, the survey will go to the last page. You can increase the delay to 5 seconds, for example.
Thank you,
Andrew
SurveyJS Team
it dosen't work for me
If you provide us an example that doesn't work, we will take a look. Unfortunately, we can't help you with it, because it works on our side and for other developers.
Thank you,
Andrew
SurveyJS Team