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.01k stars 782 forks source link

Allow to preview answers before posting the results #2170

Closed andrewtelnov closed 4 years ago

andrewtelnov commented 4 years ago

Many surveys/forms allow end-users to preview their answers before completing the survey/form. Right now, some of developers use display mode and second survey to create this functionality. We should have it out of the box: Instead of "Complete" button we show "Preview" button. When end-user press "Preview button", we will show all questions, or optionally only answered, in read-only mode on one page (every page converts into a panel with an "Edit" button"). End-user can go to edit mode again, by pressing "Edit" button on a panel to start editing survey again with a particular page or press "Edit" button on Navigation tab to start from the beginning. If an end-user satisfies with results, he/she will press "Complete" button.

New property: survey.showPreviewBeforeComplete: string, ["noPreview", "showAllQuestions", "showAnsweredQuestions"], "noPreview" is the default value. New methods: survey.showPreview(): boolean - go to preview mode, returns false if there is an error on the page. survey.cancelPreview() - go back to edit mode.

The example is here.

sovetski commented 9 months ago

How to disable the "edit" possibility before sending results? Is there any option like "showPreviewAfterComplete"?

JaneSjs commented 9 months ago

Hi @sovetski, Please refer to my answer at https://github.com/surveyjs/survey-library/issues/7056.

Thanks