With regard to this post, when more questions are added, to the same or different page, only the last question is correctly displayed. The other questions just show the structure (e.g. multiple choices, lists). The following code shows the problem:
function createForm() {
var title = 'Multipage Form Test';
var description = 'Stackoverflow question 17083500';
var form = FormApp.create('Questionnaire')
.setDescription('Questionnaire')
.setConfirmationMessage('Thanks for responding!');
var page1 = form.addPageBreakItem()
.setTitle('First page');
var item = form.addMultipleChoiceItem();
var item = form.addListItem();
var item = form.addMultipleChoiceItem();
var page2 = form.addPageBreakItem()
.setTitle('Second page');
var item = form.addMultipleChoiceItem();
var page3 = form.addPageBreakItem()
.setTitle('Third page');
item.setTitle('Question')
.setChoices([
item.createChoice('Yes'),
item.createChoice('No')
]);
item.setTitle('Question')
.setChoices([
item.createChoice('Yes',page2),
item.createChoice('No',page3)
]);
item.setTitle('Question')
.setChoices([
item.createChoice('Yes'),
item.createChoice('No')
]);
item.setTitle('Question')
.setChoices([
item.createChoice('Yes'),
item.createChoice('No')
]);
Logger.log(form.getEditUrl());
Logger.log(form.getPublishedUrl());
}
How is it possible to assign and display the questions to pages correctly?
Thanks a lot for your answer, sofia p.