javascript - Google Apps Script google.script.run html not working, script not launched
问题描述
I really hope you can help me with this! I do not understand why my html 'script' does not want to communicate with my 'code' as it was happening before.
This is the story. I have built a little application with Google Apps Script. I wanted to transfer this application to another Google user, therefore I shared the file, then I made a copy so I would result as the owner.
Into this application I have a an html form that is called, user click a button, and the text of the button will be transferred to some cells in the Gsheet.
So for the first account, where the application comes from, it still works fine. For the second account it does not, and I can not figure out why. Is it something connected to the user? Is it something wrong into the code? Is it connected to the new Apps Script runtime powered by V8 recently released?
Please help me, it is quite important to me.
function NewshowDialog()
{
var title = "Please Select STOP Reason";
var uiDialog = HtmlService.createHtmlOutputFromFile('NewDialoghtml_ENG').setSandboxMode(HtmlService.SandboxMode.NATIVE);}
uiDialog.setWidth(630);
uiDialog.setHeight(330);
return SpreadsheetApp.getUi().showModalDialog(uiDialog,title);
}
function msgbox_success()
{SpreadsheetApp.getUi().alert("Success");}
function msgbox_error()
{SpreadsheetApp.getUi().alert("Fail");}
function WriteInBreakName(breakname)
{ //write value in cells into the Gsheet}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function onSuccess() {
google.script.run.msgbox_success();
}
function onFailure() {
google.script.run.msgbox_error();
}
function myFunctionBreak_eng()
{
var breakname = document.getElementById("buttonBreak_eng").value;
google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).WriteInBreakName(breakname);
google.script.host.close();
}
window.closeDia = function()
{
google.script.host.close();
};
</script>
<style>
.BreakButton {
box-shadow: 0px 1px 0px 0px #f0f7fa;
background:linear-gradient(to bottom, #83d6f2 5%, #019ad2 100%);
background-color:#83d6f2;
border-radius:6px;
border:1px solid #bcbcbc;
display:inline-block;
cursor:pointer;
color:#222222;
font-family:Arial;
font-size:38px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #cbe6ef;
height:150px;
width:200px;
}
.BreakButton:hover {
background:linear-gradient(to bottom, #019ad2 5%, #83d6f2 100%);
background-color:#019ad2;
}
.BreakButton:active {
position:relative;
top:4px;
</style>
</head>
<body>
<button class="BreakButton" type="button" id="buttonBreak_eng" value="Break" onclick="myFunctionBreak_eng()">Break</button>
</body>
</html>
解决方案
推荐阅读
- windows - Greps 对 Wine 程序生成的文本文件不返回任何内容
- algorithm - 具有实心/空叶的 3D 二进制空间分区
- c# - C# WinForms ToolStripTextBox 大小调整和检测按键
- flutter - 如何在 24 小时延迟后允许运行功能
- laravel - laravel 7中的授权与门
- karate - 为什么 response.item[*].id 在空手道 JsonPath 中不起作用
- c# - c# 中 `this` 和 `ref` 的等效功能
- excel - 无法使用 Selenium VBA 在 Chrome 中循环 Excel 数据
- java - 创建频道后如何获取频道的id
- python - PDE 求解:“NoneType”没有属性“toarray”错误