6
votes

I have a questionnaire created using Google form. When the user fill in the answer, some questions should be skipped based on the answer of some previous questions. While I can trust the user that they will follow the instruction, I feel that I can improve it by hiding the questions.

I know I can do that by separating the questionnaire into pages and use the default "go to page" function provided by Google form. However, as there are too many questions of this kind, I don't want the user to wait for page loading after nearly every question. Sadly, there is no default option to show/hide a question based on user choice in Google form.

Then, I found that there is a Google app script thing. I guess it can help me to implement such basic things, but then I am frustrated that I am not even able to locate an object in the questionnaire, and it seems it lacks a function to control the visibility of a question objects. (or at least, not found in the menu)

The link to the menu provided by Google: https://developers.google.com/apps-script/reference/forms/

I am completely lost now. I have Google and search here in Stack Overflow, but nothing's found. Any idea on how can I proceed?

1

1 Answers

7
votes

We can't currently access or manipulate any items in a live Google Form, with Google Apps Script, as the user is filling it out. Only the Google Form builder can be programatically controlled. A script can either help build a form before it's opened or be setup to trigger a function to run after a response has been submitted. See quickstart for working with Google Form responses and the Add-on example for the Google Form builder.

To dynamically show form items or change input values as users are filling it out:

  1. Build and deploy your own web app that acts like a form with HtmlService ( hosted on script.google.com )
  2. Build a regular HTML form hosted on your own service.