提交触发器上的表单 [英] Forms On Submit Trigger

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

问题描述

我创建了一个简单的Google表单,并试图在提交表单时运行一个Apps脚本。作为一个简单的测试,以确保我的脚本被调用,我的脚本只是写入日志:

pre $函数onFormSubmit(e) {
Logger.log(Testing);
}

然后我试着通过Edit> Current project's triggers 。我在运行字段中选择函数名称,在事件字段中选择从表单和表单提交。我点击保存按钮并出现错误很抱歉,发生服务器错误,请稍等一会再试。弹出在屏幕的顶部。

我已经用不同的函数名称,函数代码(甚至在函数中根本没有代码,只是一个评论!)等,但我总是得到那个错误。我也尝试从不同的Google帐户和不同的浏览器(Firefox和Chrome)执行此操作,并获得相同的错误。我尝试创建一个不在表单内的简单独立脚本,我可以为它设置一个定时触发器,它工作正常。



如果我手动运行代码然后它工作正常,并且消息被添加到日志文件中,所以我认为错误不在我的代码中。



是否有另一个步骤我错过了什么地方?某种形式的身份验证或发布或其他什么?



也许它确实是一个服务器问题,我只需等待,到目前为止,我一直在收到最后一个错误3小时。

解决方案

在试图添加表单提交时,我在最近几天得到完全相同的行为触发附加到Google表单的脚​​本。我选择编辑>当前项目的触发器,我从列表中选择(唯一)函数,确保选择了从表单和表单提交,然后当我单击保存时,我得到我们很抱歉,发生服务器错误,请稍等一会,然后重试错误。


I've created a simple Google Forms form and am trying to get it to run an Apps Script when the form is submitted. As a simple test to make sure my script is being called, my script simply writes to the log:

function onFormSubmit(e) {
  Logger.log("Testing");
}

I then tried to add the trigger by going "Edit > Current project's triggers". I select the function name in the Run field and "From form" and "On form submit" in the Events fields. I click the Save button and get the error "We're sorry, a server error occurred. Please wait a bit and try again." pop up at the top of the screen.

I've tried this multiple times with different function names, function code (even no code at all in the function, just a comment!), etc but I always get that error. I've also tried doing this from a different Google account and in different browsers (Firefox and Chrome) and get the same error. I tried creating a simple stand-alone script that isn't within a Form, and I was able to set a timed trigger for it and it worked fine.

If I manually run the code then it works fine and the message gets added to the log file, so I assume that the error isn't with my code.

Is there another step that I've missed somewhere? Some sort of authentication or publishing or something?

Maybe it really is a server issue and I just have to wait, so far I've been getting the error for the last 3 hours.

解决方案

I've been getting the exact same behavior for the last couple of days when trying to add a form submit trigger to a script attached to a Google Form. I go to Edit > Current project's triggers, I select the (only) function from the list, I make sure that "From form" and "On form submit" are selected, and then when I click Save, I get the "We're sorry, a server error occurred. Please wait a bit and try again" error.

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

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