首页 > 解决方案 > 如何将增量字段添加到 Google 表单

问题描述

我想创建一个带有一个增量 id 的 google 表单,并在提交 google 表单时向用户显示该 id,我已经对其进行了一些搜索,但根据我的需要,我没有得到答案。如果有人知道解决此问题的任何方法,请告诉我。我对谷歌表单不太了解

我已经搜索过它,发现它可能使用 google form add-ons

我只想要一个包含 4-5 个字段和一个增量 ID 的简单表单,并希望在提交表单时向用户显示该 ID

标签: google-apps-scriptgoogle-forms

解决方案


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/


推荐阅读