如何获取使用新的HtmlService创建的UI中输入的值 [英] how to get value entered in UI created with the new HtmlService

查看:197
本文介绍了如何获取使用新的HtmlService创建的UI中输入的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用

I can get/access the value of the UI elements using,

e.parameter.elementname or app.getElementById(id) 


app.add(app.loadComponent("MyGui"));
app.getElementbyId('textbox1').setText("Hi");

如果我使用HtmlService.createHtmlOutputFromFile('myPage');
如何获取在html表单中输入的值 - 元素?

If i use, HtmlService.createHtmlOutputFromFile('myPage'); How can i get the values entered in the html form - elements ?

推荐答案

使用HtmlService时,您需要重新思考您的应用程序主要基于客户端而不是基于服务器。您可以(在客户端JavaScript中)为任何元素添加更改处理程序,并使用该值执行某些操作,包括使用google.script.run.myFunction(someValue)调用服务器函数。请参阅此处的新用户指南: https://developers.google.com/apps-script/html_service

When using HtmlService you need to rethink your app to be primarily client based not server based. You can (in client-side JavaScript) add a change handler to any element and do something with the value, including calling a server function with google.script.run.myFunction(someValue). See the new user guide here: https://developers.google.com/apps-script/html_service

这篇关于如何获取使用新的HtmlService创建的UI中输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆