Continue an Incomplete Survey
Respondents may not complete your survey in a single session. In this case, you can restore their answers from the previous session next time they get to the survey. Incomplete results can be loaded from your database or the browser's localStorage. This demo shows how to save and restore incomplete survey results and the last visited question and page from the localStorage. To test this functionality, answer a couple of questions and reload the page. Your answers should persist. For information on how to save incomplete results on a server, refer to the following help topic: Restore Survey Progress from a Database.
To save incomplete results, implement a function that sends them to your server or saves them in the localStorage (see the saveSurveyData function in code). Call this function within SurveyModel's onValueChanged and onCurrentPageChanged event handlers to save the results when users change a question value or switch between pages. If you use the localStorage, handle the onComplete event to submit final survey results to the server and delete them from the localStorage because they no longer need to be restored.
To restore survey results, retrieve the saved data from your server or localStorage and assign it to the SurveyModel's data property. If you also stored the page number where the respondent left off, assign it to the SurveyModel's currentPageNo property. Likewise, if you saved the name of the last visited question, call the SurveyModel's focusQuestion(name) method.