admin管理员组文章数量:1294179
I've got three files that does one simple thing:
- User via custom menu opens a modal dialog
- User clicks button on modal dialog
- button click calls a function that displays a simple alert
That's it. But...the alert gets displayed TWICE. Here is the code:
custom-menu.gs
function onOpen() {
SpreadsheetApp.getUi().createMenu('custom menu')
.addItem('button 1','someFunction')
.addToUi();
}
gas-file.gs
function someFunction() {
const htmlOutput = HtmlService.createHtmlOutputFromFile("html-file");
SpreadsheetApp.getUi().showModalDialog(htmlOutput, "Some Title");
}
function someFunc1() {
SpreadsheetApp.getUi().alert("someFunc1() has been called.")
}
html-file.html
<!DOCTYPE html>
<html>
<body>
<button type="button" onclick="submit()">Submit</button>
<script>
function submit() {
google.script.run.someFunc1();
}
</script>
</body>
</html>
I'm completely baffled. Any help would be greatly appreciated. Thank you in advance!
本文标签: javascriptGoogle Apps Script alert showing twice when called from HTML dialogStack Overflow
版权声明:本文标题:javascript - Google Apps Script alert showing twice when called from HTML dialog - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741590057a2387068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论