SoftEngStudent
SoftEngStudent

Reputation: 159

Randomize google forms sections with Gsuit?

I need to randomize the SECTIONS (not questions) in my google form. The reason I need to do sections is because every section corresponds to a video so each needs to be a section.

This is the closest thing I've gotten to a solution:

https://developers.google.com/apps-script/reference/forms/page-break-item

// Create a form and add three page-break items.
var form = FormApp.create('Form Name');
var pageTwo = form.addPageBreakItem().setTitle('Page Two');
var pageThree = form.addPageBreakItem().setTitle('Page Three');

// Make the first two pages navigate elsewhere upon completion.
pageTwo.setGoToPage(pageThree); // At end of page one (start of page two), jump to page three
pageThree.setGoToPage(FormApp.PageNavigationType.RESTART); // At end of page two, restart form

I've already made the form and don't want to remake it (so many questions, so many videos). If I could use the .setGoToPage function shown above I think I could find a solution to randomize the sections aka pages. I just don't know what the names of my already existing pages are or how to find them. Please help!!!!

Upvotes: 2

Views: 3070

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

As you noticed yourself the methods applicable to a page are very limited

  • So, while you can add a page break, you cannot retrieve it in a subsequent code execution, and thus there is no way to shuffle it.
  • There is also no way to retrieve or set the questions belonging to each page in order to create new pages with questions on each script execution.
  • You have the possibility to file relevant feature requests on Google's Public Issue Tracker, chances are they will be implemented in the future if enough users show interest
  • In the mean time, as a workaround the only 2 things I can come up with is
    • a) Duplicate your form, shuffle the pages manually from the UI for each duplicate, create a WebApp that will arbitrary redirect the user to one of the URLs of the different form versions
    • b) Summarize all questions belonging to one page / section into one question item - it is easy to shuffle opposed to pages

In case it's helpful - further information:

Upvotes: 1

Related Questions