I have a form that starts with one multiple choice item that, based on each answer chosen, will go to a specific page for them to fill out a griditem.
For the first multiple choice item, you can only chose one answer for this item. Once chosen, the user will be take to the specific page and the user fills out a griditem. After they fill out the griditem, I want them to submit the form from this page. However this is not what happens
The code navigates to the correct page as desired but depending on the first multiple choice question, there are a certain amount of pages the use can then click ‘next’ and access the other pages.
For example, there are 3 multiple choice answers for the first item, choosing option 1 would take you to option 1, then option 2, and option 3 then submit. Choosing option 2 would take you to option 2, then option 3, then submit. And choosing option 3 would take you to option 3 then submit. I want it to submit after each option.
function myFunction() {
var form = FormApp.create('Scores Form').setDescription('Description');
var item = form.addMultipleChoiceItem();
create_choice_array = []
var dict = {'page-one':['row-one','row-two'],'page-two':['row-one','row-two'],'page-three':['row-one','row-two']}
for(var key in dict){
var value = dict[key];
var team_ex = form.addPageBreakItem().setTitle(key);
var griditem = form.addGridItem()
.setTitle("Scores for ".concat(" ",key))
.setRequired(true)
.setColumns(['Did not attend', 'slightly/not engaged in activity','moderately engaged in activity', 'very engaged in activity'])
.setRows(value);
create_choice_array.push(item.createChoice(key,team_ex));
//the line of code below does not work as desired
//FormApp.PageNavigationType.SUBMIT;
}
item.setChoices([create_choice_array.pop(),create_choice_array.pop(),create_choice_array.pop()]);
//the line of code below does not work as desired
//FormApp.PageNavigationType.SUBMIT;
}
In order for submit form to happen in the correct place, I wrote this line of code in the for loop and then tried it after the for loop, but nothing changed.
FormApp.PageNavigationType.SUBMIT;
Am I placing the PageNavigationType in the wrong part of the code? Am I not accessing the items correctly? Thank you. I tried adapting some of the knowledge from these two posts but I am lost, this is my first time using apps.
How to get the PageNavigationType to work through a loop
Choices Set To a Section, Next Section, or Submit Form in Google Forms