Regardless of validation errors in the survey or the page I'm currently in…
completeLastPage() always returns true!!
Answers approved by surveyjs Support
Hello Vangelis,
I got the issue. Please use the following code instead:
JavaScriptlet terminated = !survey.currentPage.hasErrors(true, true) && survey.completeLastPage();
I have forked the example.
Thank you,
Andrew
SurveyJS Team
Comments
(2)
Hello Vangelis,
I created the following demo but didn't reproduce the issue: https://plnkr.co/edit/h1TzHbVvKaiitGMr.
If I do not specify required fields, the
completeLastPage
function returnsfalse
.Please share a reproducible demo for research?
Hi Jane.
I'm not familiar with setting up pinkr but if you modify the survey in your example to contain 2 pages and click on terminate while on 1st page, my experience is that the completeLastPage() returns true, contrary to what the documentation says.
I workedaround(sp) by moving (programmaticaly) to the last page before calling the completeLastPage()
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
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.