Question T12980
Visible to All Users

completeLastPage() always returns true!!

created 2 years ago

Regardless of validation errors in the survey or the page I'm currently in…

Show previous comments (2)
VV VV
Vangelis Vassiliadis 2 years ago

    I've modifies your example. Not sure If you can view my modifications.
    The lastpage() returns true IFF you're not in last page and have set
    window.survey.checkErrorsMode = "onComplete";

      Hello Vangelis,
      Could you please open the example, fork it, make the required changes and post a new link here?
      I have updated Jane's example by setting survey.checkErrorsMode = "onComplete";

      Thank you,
      Andrew
      SurveyJS Team

      VV VV
      Vangelis Vassiliadis 2 years ago

        Hi,

        please see the forked here: https://plnkr.co/edit/MskBxNbLCD7MwIQt

        When checkErrorsMode = "onComplete" AND not in the last page, completeLastPage returns true.

        My use case is that checks should be made on a 'Terminate' custom button, (not on every page)…
        Again, I've solved it by setting currentPageNo to lastpage prior to calling the completeLastPage.
        I just think you should update the documentation.

        Answers approved by surveyjs Support

        created 2 years ago

        Hello Vangelis,
        I got the issue. Please use the following code instead:

        JavaScript
        let terminated = !survey.currentPage.hasErrors(truetrue) && survey.completeLastPage();

        I have forked the example.

        Thank you,
        Andrew
        SurveyJS Team

          Comments (2)
          VV VV
          Vangelis Vassiliadis 2 years ago

            Thank you Andrew.

              You are very welcome!

              Andrew
              SurveyJS Team