我正在使用SurveyJS(https://surveyjs.io/)来制作一个简单的网站,很少有问题。我可以使用SurveyJS提供的选项来执行所有逻辑。
但是,我要做的是:
false
,请不要移至下一个问题。 (不起作用) 无论我做什么,调查都会继续移至下一个问题,在这种情况下,我想避免这种情况。
三个可用的回调:
// triggers before the current page goes away
survey.onCurrentPageChanging.add(function (sender, options) {
if(survey.data.year === "1991") {
// let's say I want to stop user from going forward at this point.
// how can I do that?
}
});
// triggers after the current page is gone and new page is about to appear
survey.onCurrentPageChanged.add(function (sender) {
});
// triggers right before the survey is about to finish - the last page
survey.onCompleting.add(function (sender, options) {
});
谢谢您的时间。
答案 0 :(得分:1)
survey.onCurrentPageChanging.add(function (sender, options) {
if(survey.data.year === "1991") {
// This prevents survey go to the next page
options.allowChanging = false;
}
});