为'表单提交'触发器指定表单 [英] Specifying form for 'on form submit' trigger

查看:184
本文介绍了为'表单提交'触发器指定表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Google表单,它们将数据发送到一个电子表格中的两个选项卡。



我已经设置了一个具有两个功能的脚本。我希望第一个函数能够在提交第一个表单时运行。而第二个函数在提交第二个表单时运行。

问题是:在设置触发器时,它不允许指定哪个 b
$ b

因此,无论何时完成第一个表单,它都会运行这两个函数。

问题:如何限制函数仅在提交特定表单时运行?

只是看了一些文档,发现这一点:



文档forForm



它表示:

< blockquote>

创建并返回绑定到给定表单的FormTriggerBuilder。

另外:

  var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); 
ScriptApp.newTrigger('myFunction')
.forForm(form)
.onFormSubmit()
.create();

onFormSubmit



该代码似乎与特定的表单绑定。 / p>

I have two google forms, which send data to two tabs in a single spreadsheet.

I have set up a script with two functions. I would like the first function to run on submission of the first form. And, the second function to run on submission of the second form.

Problem is: when setting up a trigger onformsubmit, it does not allow you to specify which form.

Therefore, whenever completing the first form, it runs both functions.

Question: how can I restrict the functions from running only when the specific form is submitted?

解决方案

I was just looking at some documentation and found this:

Documentation forForm

It states:

Creates and returns a FormTriggerBuilder tied to the given form.

Also:

var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
 ScriptApp.newTrigger('myFunction')
     .forForm(form)
     .onFormSubmit()
     .create();

onFormSubmit

That code seems to be tied to a specific form.

这篇关于为'表单提交'触发器指定表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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