[英]How are my “Includes” breaking the form submission in a Standalone Google Apps Script?
I've been using this script to create this web app . 我一直在使用此脚本来创建此Web应用程序 。 It's supposed to take in a form submission and transfer the data to a google sheet.
应该以表单提交的形式将数据传输到Google工作表。 Once it's done that, it should clear the fields and start over.
完成后,应清除字段并重新开始。 This one works (for the most part).
这一工作(大部分情况下)。
I tried to clean up the script by adding includes in the Code.gs file. 我试图通过在Code.gs文件中添加include来清理脚本。 Once I changed the script to this to create the same web app, I get this as a result (you have to actually submit something to see it).
将脚本更改为此以创建相同的Web应用程序后, 我得到了这个结果(您必须提交一些内容才能看到它)。 Once you click submit, nothing runs, and the page switches to some crazy web address.
单击提交后,任何内容都不会运行,并且页面会切换到一些疯狂的网址。
I'm pretty sure the problem is the difference between this (the original Code.gs): 我很确定问题是这两者之间的区别(原始Code.gs):
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('Index')
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
}
and this (the new Code.gs): 这(新的Code.gs):
function doGet(request) {
return HtmlService.createTemplateFromFile('Index')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
I just don't know enough to see the problem. 我只是不了解该问题。
You're using Logger.log() statements inside the javascript tags. 您正在javascript标记内使用Logger.log()语句。 They're specific to google script so will not work outside of it.
它们特定于Google脚本,因此无法在其外部运行。
Disabling them made the form work. 禁用它们使表格起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.