how to get value entered in UI created with the ne

2019-01-18 07:37发布

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

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

if i create UI using UiApps or GUI builder like,

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

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

2条回答
地球回转人心会变
2楼-- · 2019-01-18 08:16

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

查看更多
▲ chillily
3楼-- · 2019-01-18 08:19

As an alternative to client-side JavaScript, you can also create simple forms that submit to the doPost() handler which then processes the data. I created a sample script to demonstrate: Run, Source

查看更多
登录 后发表回答