Dynamically show / hide form items using Google App Script in Google Form

点点圈 提交于 2019-11-26 17:08:40

问题


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:


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.


来源:https://stackoverflow.com/questions/19563199/dynamically-show-hide-form-items-using-google-app-script-in-google-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!