谷歌应用程序脚本运行程序不调用函数

时间:2015-06-27 22:53:10

标签: google-apps-script google-apps

我已经开发了一段时间的应用程序脚本项目并且工作正常,但突然它不再发送表单结果回到我的.gs脚本。我的代码采用html表单来获取用户输入,并将其传递回我的脚本以进行工作。我的代码更复杂,但概念与下面发布的相同。

function test()
{
  var html += '<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" />';
  html += "</form>";
  var htmlOutput = HtmlService
     .createHtmlOutput(html)
     .setSandboxMode(HtmlService.SandboxMode.IFRAME)
     .setWidth(450)
     .setHeight(300);
  Logger.log(html);
 SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'enter anything');
}

function printForm(formObject)
{
  Logger.log("hello?");
  Logger.log(formObject.testy);
  SpreadsheetApp.getUi().alert("hello world!");
}

我的问题是我的函数printEorm在这种情况下永远不会被调用。直到本周早些时候才进行重大的代码更改。没有错误返回,实际上执行脚本显示脚本成功。

[15-06-27 15:41:58:645 PDT] Starting execution
[15-06-27 15:41:58:657 PDT] HtmlService.createHtmlOutput([<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" /></form>]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setSandboxMode([IFRAME]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setWidth([450]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setHeight([300]) [0 seconds]
[15-06-27 15:41:58:660 PDT] Logger.log([<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" /></form>, []]) [0 seconds]
[15-06-27 15:41:58:660 PDT] SpreadsheetApp.getUi() [0 seconds]
[15-06-27 15:41:58:904 PDT] Ui.showModalDialog([HtmlOutput, Select Your Player to Draft]) [0.243 seconds]
[15-06-27 15:41:58:905 PDT] Execution succeeded [0.248 seconds total runtime]

我试着弄清楚发生了什么变化,可能是谷歌方面,为什么剧本选手没有调用我的功能。重申一下,这个确切的测试代码在一周前与我使用类似概念的大型项目一起工作。

到目前为止,我已经尝试了4种不同的浏览器,Chrome,opera,firefox(从未工作过)和IE。在那里阅读似乎有一些问题firefox和脚本运行,所以它仍然无法正常工作。

我的TL; DR:在谷歌应用程序脚本中,如果上面的代码没有,你如何从html表单获取用户输入并将其传递回服务器端脚本?

编辑:浏览应用程序脚本问题Sandy Good链接我不是唯一一个有脚本运行者突然无法工作的问题。每当我发现更多信息时,我都会更新。

0 个答案:

没有答案
相关问题