Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script google应用程序脚本运行程序未调用函数_Google Apps Script_Google Apps - Fatal编程技术网

Google apps script google应用程序脚本运行程序未调用函数

Google apps script google应用程序脚本运行程序未调用函数,google-apps-script,google-apps,Google Apps Script,Google Apps,我在一个应用程序脚本项目上工作了一段时间,它工作得很好,但突然它不再将表单结果发送回my.gs脚本。我的代码采用html表单获取用户输入,并将其传递回脚本进行工作。我的代码更复杂,但概念与下面发布的相同 function test() { var html += '<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit"

我在一个应用程序脚本项目上工作了一段时间,它工作得很好,但突然它不再将表单结果发送回my.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!");
}
我的问题是,我的函数,本例中的printForm,从未被调用。直到本周早些时候,它还没有进行重大的代码更改。没有返回错误,事实上执行记录显示脚本成功

[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:在google应用程序脚本中,如果上面的代码没有,如何从html表单获取用户输入并将其传递回服务器端脚本


编辑:查看应用程序脚本问题Sandy Good linked Im不是唯一一个出现脚本运行程序突然无法运行问题的人。我会在发现更多信息时进行更新。

我使用了您的代码,可以确认它不起作用,但它应该起作用。我尝试了几种不同的方法,但没有成功。这是一只虫子。你应该提出一个问题。Hrm:/我有一种感觉…我只添加了一个开关,该开关已经存在,以考虑不同的用户输入,但现在它不再工作。我想也许谷歌改变了html的处理方式,但它看起来是一样的。谢谢。我看不出你在哪里调用printForm,你只需打开接口就可以了……你应该在某个地方调用它……如果从接口调用,使用google.script.run.printForm。-由于接口在客户端异步工作,所以当第一个方法完成时,执行确实结束。并且记录器在客户端不工作。google.script.run.printForm应该调用printForm onclick。如果你向右滚动,它就在那里。很抱歉,它不是理想的线条长度。这是一个快速测试。我的问题是google.script.run.printForm从不调用printForm。