survey-library icon indicating copy to clipboard operation
survey-library copied to clipboard

Data saving errors hidden by showCompletedPage

Open SamMousa opened this issue 3 years ago • 3 comments

Are you requesting a feature, reporting a bug or asking a question?

Bug / question

What is the current behavior?

The showCompletedPage option effects not only the display of the contents of completedHtml, but also of the data upload progress.

What is the expected behavior?

When data uploads fails (ie options.showDataSavingError() is called), the library shows a retry button. But if showCompletedPage is false then this button is not shown; instead the user is stuck on an empty screen.

I'd love to see the saving status, but not the completedHtml when the showCompletedPage is disabled.

How would you reproduce the current behavior (if this is a bug)?

Go here: https://plnkr.co/edit/DWqo5vM7iqwzBDd6 Complete the survey and observe that you do not get any visible indicator showing that data upload failed.

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://plnkr.co/edit/DWqo5vM7iqwzBDd6

Test code

Survey.StylesManager.applyTheme("defaultV2");
var json = {
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "rating",
          "name": "nps_score",
          "title": "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?",
          "isRequired": true,
          "rateMin": 0,
          "rateMax": 10,
          "minRateDescription": "(Most unlikely)",
          "maxRateDescription": "(Most likely)"
        }, {
          "type": "checkbox",
          "name": "promoter_features",
          "visibleIf": "{nps_score} >= 9",
          "title": "Which of the following features do you value the most?",
          "description": "Please select no more than three features.",
          "isRequired": true,
          "validators": [
            {
              "type": "answercount",
              "text": "Please select no more than three features.",
              "maxCount": 3
            }
          ],
          "hasOther": true,
          "choices": [
            "Performance",
            "Stability",
            "User interface",
            "Complete functionality",
            "Learning materials (documentation, demos, code examples)",
            "Quality support"
          ],
          "otherText": "Other features:",
          "colCount": 2
        }, {
          "type": "comment",
          "name": "passive_experience",
          "visibleIf": "{nps_score} >= 7  and {nps_score} <= 8",
          "title": "What can we do to make your experience more satisfying?"
        }, {
          "type": "comment",
          "name": "disappointing_experience",
          "visibleIf": "{nps_score} <= 6",
          "title": "Please let us know why you had such a disappointing experience with our product"
        }
      ]
    }
  ],
  "completedHtml": "<h3>Thank you for your feedback</h3>",
  "completedHtmlOnCondition": [
    {
      "expression": "{nps_score} >= 9",
      "html": "<h3>Thank you for your feedback</h3> <h4>We are glad that you love our product. Your ideas and suggestions will help us make it even better.</h4>"
    }, {
      "expression": "{nps_score} >= 6  and {nps_score} <= 8",
      "html": "<h3>Thank you for your feedback</h3> <h4>We are glad that you shared your ideas with us. They will help us make our product better.</h4>"
    }
  ],
  "showCompletedPage": false,
  "showQuestionNumbers": "off"
};
window.survey = new SurveyKnockout.Survey(json);

survey.onComplete.add(function (sender, options) {
options.showDataSavingError(error);
});

Specify your

  • browser: N/A
  • browser version: N/A
  • surveyjs platform (angular or react or jquery or knockout or vue): knockout
  • surveyjs version: 1.9.49

SamMousa avatar Sep 16 '22 08:09 SamMousa

@SamMousa if "showCompletedPage" is false, it means that we hide survey container completely on "completing" the survey. We do not have a container to show an error. It is a designed behavior. We definitely need to update the documentation. @RomanTsukanov could you please correct our docs?

andrewtelnov avatar Sep 19 '22 13:09 andrewtelnov

So to have just the data saving status we empty completedHtml? Or we implement the status ourselves, since it's our code doing the saving in the complete callback anyway

SamMousa avatar Sep 19 '22 13:09 SamMousa

@SamMousa Correct, since you turn-off the default UI, you can create your own UI based on your needs.

Thank you, Andrew

andrewtelnov avatar Sep 19 '22 14:09 andrewtelnov

Hi @SamMousa,

Thanks a lot for bringing this issue to our attention. After a discussion, the team decided to create a separate page for the data saving progress UI. Once implemented, this UI will be independent of the Complete page. I created a separate issue #4898 for this enhancement. Please note that it is not in our immediate to-do list, and we cannot give you any time estimates. However, you can subscribe to the aforementioned issue to be notified once the enhancement is available. For the moment, we have added a note about the current behavior to our docs via PR #4897.

Thanks again, Roman

RomanTsukanov avatar Sep 23 '22 14:09 RomanTsukanov