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

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

问题描述

我有一份使用 Google 表单创建的问卷.用户在填写答案时,在之前的一些问题的回答基础上,应该跳过一些问题.虽然我可以相信用户会按照说明进行操作,但我觉得我可以通过隐藏问题来改进它.

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.

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

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)

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

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

我现在完全迷失了.我有谷歌并在 Stack Overflow 中搜索,但什么也没找到.知道如何继续吗?

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?

推荐答案

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

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. 使用 HtmlService(托管在 script.google.com 上)
  2. 构建托管在您自己的服务上的常规 HTML 表单.
  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 Form 中使用 Google App Script 动态显示/隐藏表单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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