添加“;密码”;键入Google Apps Script inputBox
Adding "password" type to Google Apps Script inputBox
是否可以将"密码"类型分配给Google Apps脚本输入框,这样文本就不会显示?
以下操作很好,但输入字段是一个简单的文本框,显示的是文本而不是"••••":
Browser.inputBox('Please enter your password');
我有一个带有关联脚本的谷歌工作表,该脚本自动填充一些单元格,其中包含从外部API检索到的信息。API需要简单的身份验证,这就是我提示用户输入用户名和密码的原因(这是针对内部工具的,因此询问密码没有问题,密码没有被存储或其他任何问题)。
根据Sandy Good的评论,我最终使用了一个带有HTML服务的自定义对话框。
以下操作非常适合显示输入类型"password"并将值传递给我的谷歌脚本:
pw_input.html
<script>
function updateInfo(form) {
google.script.run.myOtherScript(form.password.value);
google.script.host.close();
}
</script>
<form>
Password:
<input type="password" name="password">
<input type="button" value="OK" onclick="updateInfo(this.form)" />
</form>
main.gs
function myMainFunc() {
onOpen();
var html = HtmlService.createHtmlOutputFromFile('pw_input')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi()
.showModalDialog(html, 'Please enter your password');
};
其他脚本.gs
function myOtherScript(promptResponse) {
etc...
};
相关文章:
- Google Apps Script中的标准Javascript
- 使用 Apps Script API 的 Chrome 应用
- 添加“;密码”;键入Google Apps Script inputBox
- HTTP POST 和 Google Apps Script 文件上传
- Google Apps Script 中基于 Twitter OAuth Pin 的授权“oob”
- Google-apps-script不会在onEdit函数中发送电子邮件
- 在 Google Apps Script Web App 中显示文件和文件夹
- 根据Google Apps Script中的答案创建表单问题
- Bootstrap.js可以在GAS(Google Apps Script)中使用
- Google Tag Manager 和 Google Apps Script 之间有什么区别
- 加号转换为Google Apps Script + MySQL中的空格
- 将HTML图片添加到Google Apps Script中
- 将值从 ajax 传递到 Google Apps Script
- Google Apps Script 的 Content Service 返回 HTML 而不是 JSON
- 提示用户在Google Apps Script上输入,“getUi()”方法出错
- Google Apps Script EventHandlers with userdata
- Google Apps Script 返回 Code.gs 中的对象
- google.load and google apps script
- 如何在Google Apps Script中从服务器调用函数
- 使用Google Apps Script创建“老式”邮件合并时出现问题