HTML Service - Uncaught NetworkError: Form submission failed

梦想与她 提交于 2019-12-10 22:09:35

问题


I am working through the google example code for HTML Service: Communicate with Server Functions.

I can't get the sample code to work for "Forms'. Is there an error in the code or is it something in my browser config?

The code is -

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>

The error in the debug windows of my browser is

Uncaught NetworkError: Form submission failed.

Thanks in advance. Will Brown.


回答1:


This error is not due to a code problem at all, rather it is an interaction between a browser plug-in and Google's authentication services. See Issue 3339 and Issue 4394.

If you're using the LastPass password manager plugin, it must be disabled.


PS: @user3531933 - if you add your own answer, just leave a comment for me, and I'll happily delete this and leave it to you.



来源:https://stackoverflow.com/questions/23244180/html-service-uncaught-networkerror-form-submission-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!