Survey-library: Restart survey once it is completed.

Created on 11 Dec 2017  路  10Comments  路  Source: surveyjs/survey-library

How can i go back to page 1 and restart survey once complete button is pressed?

question

Most helpful comment

@asadmalik3

survey.clear();
survey.render();

Thank you,
Andrew

All 10 comments

@asadmalik3

survey.clear();
survey.render();

Thank you,
Andrew

i am using survey-angular library, and i am generating form using below code

var survey = new Survey.ReactSurveyModel(surveyJSON);
survey.onComplete.add(sendDataToServer);
Survey.SurveyNG.render("surveyElement", {model:survey});

I dont find any method to clear the survey.

@asadmalik3 here is the example: https://plnkr.co/edit/MVXFVl0OmUG893qP25tp?p=preview

Thank you,
Andrew

@andrewtelnov thanks for your help. But i am facing a small issue, i am using survey-angular library which i have installed in my angular application through npm, here is the link to it https://www.npmjs.com/package/survey-angular

The way i am creating survey in my angular component is given below in image

image

But when on complete method is hit, i get this below error in console

image

@asadmalik3 You have the error in your console. That is why it doesn't work.
It is hard to say what is going on. Could you create an example on plunker? or provide us with JSON.
Do you use any events?

Thank you,
Andrew

@andrewtelnov Thanks alot for your help. I tried to product this error in plunkr but wasn't able to do so, it is working fine in plunkr, so it might be some issue in my local code.
I have another small question, once survey is completed i want to re-start it with some data, how can i do this? Here is the plunkr

@asadmalik3 I have made the fork and modify an example: https://plnkr.co/edit/fmKB94zpvLH2FI8Cni2v
Unfortunately, it doesn't work due a small bug. I have just fixed it. The code will work from the next minor version that we will release on the next week.

Thank you,
Andrew

Thank you. I am waiting for that update.

@andrewtelnov any word about the update? is it released?

@asadmalik3 It works as expected now. You may just try the example I have posted above.

Thank you,
Andrew

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmitrykurmanov picture dmitrykurmanov  路  3Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

nadialo picture nadialo  路  4Comments

testweird123 picture testweird123  路  4Comments

faso picture faso  路  4Comments