HtmlService的doPost与谷歌文档格式(HtmlService doPost With

2019-09-24 04:15发布

我创建了一个谷歌文档的形式,并提出了谷歌小工具,脚本的数据发布到表单的电子表格后端,然后返回一个自定义html5确认页面。

我用HTMLServicedoPost(e)doGet(e)在我的脚本代码,同时还创造了我的小工具(形式和确认HTML文件)2个HTML文件。

它写入数据到正确的电子表格小工具; 然而,这不是回来时,我用我的小工具创建正确的确认的html文件。 它返回的确认页面这是谷歌文档形式的一部分。 所述的剪断doPost的我的代码部分的下方。 没有人有任何想法如何让它回到我创造的,而不是谷歌文档一个自定义的确认HTML文件?

function doPost(e) {
  var template = HtmlService.createTemplateFromFile('confirm.html');
  template.entry_0 = e.entry_0;
  template.entry_1 = e.entry_1;
  template.entry_2 = e.entry_2;
  template.entry_3 = e.entry_3;
  template.screenshot = e.parameter.screenshot;
 return template.evaluate();  
}

在我form.html文件中的表格操作代码行如下。

<form action="<?= "https://docs.google.com/spreadsheet/formResponse?formkey=$mungedformkey" ?>" method="post">

Answer 1:

当您张贴到一个网址,该网址是什么决定下一步会发生什么 - 你的doPost从未得到调用。 作为替代方案,尝试张贴到脚本(使用的doPost或更好的使用google.script.run交语法),并使用UrlFetchApp传递数据到形式; 那么你会得到控制表单响应。



文章来源: HtmlService doPost With Google Docs Form