How can I add custom text after every survey? I just wanna display how much answers for yes after yes filed, and number of no after no filed. Also is there a way to somehow disable survey after submitting it once, so user can only answer once?
I want to add text after every survey and submit survey only once.
Answers approved by surveyjs Support
Hello,
If you wish to display some summary information at the end of a survey, you can customize a Complete Page and display required information there. For instance, to programmatically display information about user responses, you may handle the survey.onProcessHtml event and customize the options.html
if options.reason equals "completed"/"completed-before". The "completed-before" state indicates that a user has already completed the survey earlier.
To answer your second question, would you please ensure that you host your surveys in-house (rather than use our Free Survey Tool)?
Regarding the second task:
To allow a survey to detect that it was already completed, specify the survey.cookieName
property. When the survey.cookieName
is specified, the survey creates a cookie with the specified name on completion. This cookie helps ensure that users do not pass the same survey twice. On the second run, they will see the Completed Before page.
You can test the following demo: https://surveyjs.io/form-library/examples/survey-cookie/reactjs#.
Simply submit a survey. Now, try to navigate to this demo page once again. You should see the completedBeforeHtml
page:
You can define the content for this page using a survey's completedBeforeHtml
setting, or from code using the onProcessHtml
event.
I hope this information can help you. Should you have any further questions, we are here to help.