在Google表单中使用Google App脚本动态显示/隐藏表单项 [英] Dynamically show / hide form items using Google App Script in Google Form

查看:174
本文介绍了在Google表单中使用Google App脚本动态显示/隐藏表单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google表单创建了调查问卷。当用户填写答案时,应根据以前的一些问题的答案跳过一些问题。尽管我可以相信用户他们会遵从指示,但我觉得我可以通过隐藏问题来改进它。



我知道我可以通过分开问卷来做到这一点转换成页面并使用Google表单提供的默认转到页面功能。但是,由于这类问题太多,我不希望用户在几乎每个问题后都等待页面加载。不幸的是,没有默认选项可以根据用户在Google表单中的选择来显示/隐藏问题。

然后,我发现有一个Google应用程序脚本。我想它可以帮助我实现这些基本的东西,但是后来我很沮丧,我甚至无法找到调查问卷中的一个对象,并且似乎没有控制问题对象可见性的功能。 (或者至少在菜单中找不到)

Google提供的菜单链接:
https://developers.google.com/apps-script/reference/forms/



我现在完全失去了。我有谷歌并在堆栈溢出搜索,但没有发现。关于如何进行的任何想法?

解决方案

我们目前无法访问或操作实时Google窗体中的任何项目, Google Apps脚本,因为用户正在填写它。只有Google窗体构建器可以通过程序控制。脚本可以在打开表单之前帮助构建表单,也可以设置为在提交响应后触发函数运行。 查看快速入门,了解如何使用Google表单回复和 Google插件构建器的附加示例



在用户填写表单时动态显示表单项或更改输入值:


  1. 使用 HtmlService 构建和部署自己的Web应用程序, >(在script.google.com上托管)

  2. 构建一个由您自己的服务托管的常规HTML表单。


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?

解决方案

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.

这篇关于在Google表单中使用Google App脚本动态显示/隐藏表单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆