我想继续在函数abfrage()中处理来自ModalDialog的数据。我想稍后在.It上创建一个具有多个输入字段的循环,所以我不会将其写在html页面上。
function abfrage(){
let count = 1;
let html = '<input type="text" name="text">';
var t = HtmlService.createTemplateFromFile('dialogForm');
let dialog = ui.showModalDialog(t.evaluate(), 'Hello');
}dialogForm.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Userform</h1>
<table>
<?!= html ?>
</table>
<input type="button" value="Close" onclick="google.script.host.close()" >
<input type="submit" value="Submit" class="action">
</body>
</html>发布于 2020-06-05 23:11:08
gs:
function abfrage(){
let count = 1;
let html = '<form><br /><input type="text" name="text">';
var t = HtmlService.createTemplateFromFile('dialogForm');
let dialog = ui.showModalDialog(t.evaluate(), 'Hello');
}
function serversidefunctionname(obj) {
var name=obj.name;
//process name
//return html if desired
}HTML:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Userform</h1>
<?!= html ?>
<br /><input type="button" value="Close" onclick="google.script.host.close()" >
<br /><input type="button" value="Submit" class="action" onClick="processForm(this.parentNode);" />
</form>
<script>
function processForm(obj) {
google.script.run
.withSuccessHandler(function(retobj){
//process return from server side function if any
})
.serversidefunctionname(obj);
}
</script>
</body>
</html>https://stackoverflow.com/questions/62214281
复制相似问题