0
触发谷歌Apps脚本的OnSubmit功能我这里用户同样的问题: Google Apps Script - specifying form for 'on form submit' trigger 2形式拴在电子表格中不同的标签,我想触发提交相应表格的2种独立的功能。通过具体形式提交
按照给出的答案,我尝试了下面的代码,但由于某些原因,函数没有触发提交这些表单。
var form1 = FormApp.openById('FormID1');
ScriptApp.newTrigger('OnForm1SubmitFunction')
.forForm(form1)
.onFormSubmit()
.create();
OnForm1SubmitFunction() {
blah;
}
var form2 = FormApp.openById('FormID2');
ScriptApp.newTrigger('OnForm2SubmitFunction')
.forForm(form2)
.onFormSubmit()
.create();
OnForm2SubmitFunction() {
blah;
}
我可以使用给出的其他解决方案,它使用标准的formsubmit触发器事件并检查提交字段,例如。 if(e.namedValues [“Untitled Question 2”]!= undefined) 确定提交哪个表单。但是,将函数触发器绑定到特定表单并允许为每个表单提交触发单独函数的第一个解决方案似乎更加优雅,只要我能够实现它。
任何帮助非常感谢,谢谢!