google-apps-script - 如何将增量字段添加到 Google 表单
问题描述
我想创建一个带有一个增量 id 的 google 表单,并在提交 google 表单时向用户显示该 id,我已经对其进行了一些搜索,但根据我的需要,我没有得到答案。如果有人知道解决此问题的任何方法,请告诉我。我对谷歌表单不太了解
我已经搜索过它,发现它可能使用 google form add-ons
我只想要一个包含 4-5 个字段和一个增量 ID 的简单表单,并希望在提交表单时向用户显示该 ID
解决方案
You can't do anything like this. Because
- No ways to edit the current response
- We can't set a default value for Form's fields
You can surrogate of this
/**
* @typedef {Object} FormSubmit
* @property {GoogleAppsScript.Forms.Form} source
*/
/**
*
* @param {FormSubmit} e
*/
function onsubmit(e) {
var form = e.source;
var c = form.getItems()[0].asListItem();
c.setChoiceValues([+c.getChoices()[0].getValue() + 1]);
}
See the video example https://www.facebook.com/oshliaer/videos/2438414829578425/
推荐阅读
- android - 在改造 onResponse 方法中运行挂起函数
- javascript - 为什么这个 Node 脚本会重复计算
- sql - 使用列值作为表名连接表
- java - 数字从不相邻出现
- python - 为什么为字典的键“True”赋值会覆盖同一字典中键“1”的值?
- python - Python将json blob读入元组?
- javascript - 在 CSS 中使用 JavaScript
- sql - 使用 oracle sql 在 where 子句中计算带有日期范围的运行总计
- flutter - 'List 类型的值
' 不能分配给 'Future 类型的变量 - >'
- node.js - 在 VSCode 上调试电子时出现奇怪的警告