HTML服务 - 未捕获NetworkError:表单提交失败 [英] HTML Service - Uncaught NetworkError: Form submission failed
问题描述
我正在通过 HTML服务中的谷歌示例代码:与服务器功能进行通信。
我无法获得适用于Forms的示例代码。代码中是否存在错误,或者是否存在于浏览器配置中?
代码是 -
code.gs
函数doGet(){
return HtmlService.createHtmlOutputFromFile('index');
}
函数processForm(formObject){
var formBlob = formObject.myFile;
var driveFile = DriveApp.createFile(formBlob);
return driveFile.getUrl();
}
index.html
< pre $ < script>
function updateUrl(url){
var div = document.getElementById('output');
div.innerHTML =' < a href ='+ url +'>明白了!< / a>';
}
< / script>
< form id =myForm>
< input name =myFiletype =file/>
< input type =buttonvalue =Submit
onclick =google.script.run
.withSuccessHandler(updateUrl)
.processForm(this.parentNode) />
< / form>
< div id =output>< / div>
我浏览器的调试窗口中的错误是
Uncaught NetworkError:表单提交失败。
预先感谢。 Will Brown。
这个错误不是由于代码问题,而是浏览器插件之间的交互, in和Google的身份验证服务。请参阅 Issue 3339 和 Issue 4394 。
如果您使用的是 LastPass 密码管理器插件,则必须禁用它。
PS:@ user3531933 - 如果您添加自己的答案,请留下评论,我我会很高兴地删除它并将它留给你。
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.
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.
这篇关于HTML服务 - 未捕获NetworkError:表单提交失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!