More actions
Created page with "To make single questions automatically go to next question when an answer option has been selected, put the script on questionnaire's javascript of editor <source lang="javas..." |
No edit summary |
||
Line 11: | Line 11: | ||
var ao = this.getAnswer()[0]; | var ao = this.getAnswer()[0]; | ||
if (!ao || ao.open) return; //ignore Open answer | if (!ao || ao.open) return; //ignore Open answer | ||
as.moveToNextPage(); | if (typeof as.onTriggerEnterKey === "function") as.onTriggerEnterKey(q); | ||
else as.moveToNextPage(); //backwards compatible | |||
}); | }); | ||
}); | }); |
Revision as of 06:09, 16 October 2020
To make single questions automatically go to next question when an answer option has been selected, put the script on questionnaire's javascript of editor
AnswerSheet.bind('afterShowPage', function(ev, as) {
//check current is Single Question
if (as.questions.length != 1) return;
var q = as.questions[0];
if (q.type != 1) return;
//auto next
q.answerOptions.bind('selectionChanged', function() {
var ao = this.getAnswer()[0];
if (!ao || ao.open) return; //ignore Open answer
if (typeof as.onTriggerEnterKey === "function") as.onTriggerEnterKey(q);
else as.moveToNextPage(); //backwards compatible
});
});