HTML服务 - 未捕获的NetworkError:表单提交失败

时间:2014-04-23 12:23:10

标签: google-apps-script lastpass

我正在处理HTML Service: Communicate with Server Functions的Google示例代码。

我无法让示例代码适用于“表单”。代码中是否有错误或者我的浏览器配置中是否有错误?

代码是 -

code.gs

function doGet() {
  return HtmlService.createHtmlOutputFromFile('index');
}

function processForm(formObject) {
  var formBlob = formObject.myFile;
  var driveFile = DriveApp.createFile(formBlob);
  return driveFile.getUrl();
}

的index.html

<script>
  function updateUrl(url) {
    var div = document.getElementById('output');
    div.innerHTML = '<a href="' + url + '">Got it!</a>';
  }
</script>
<form id="myForm">
  <input name="myFile" type="file" />
  <input type="button" value="Submit"
      onclick="google.script.run
          .withSuccessHandler(updateUrl)
          .processForm(this.parentNode)" />
</form>
<div id="output"></div>

浏览器调试窗口中的错误是

Uncaught NetworkError: Form submission failed.

提前致谢。威尔布朗。

1 个答案:

答案 0 :(得分:0)

此错误根本不是代码问题,而是浏览器插件与Google身份验证服务之间的交互。请参阅Issue 3339Issue 4394

如果您使用的是LastPass密码管理器插件,则必须将其禁用。

PS:@ user3531933 - 如果您添加自己的答案,请给我留言,我很乐意将其删除并留给您。 < / p>