2

我正在制作一个脚本,它本质上是一个提交电子邮件的表单。有一个提交和一个重置按钮。我希望完成的目标是重置按钮重新加载 Google 网站或重新加载应用程序脚本。我可以使用 Google Apps 脚本中的函数来完成此操作吗?

4

1 回答 1

2

通过将所有内容放在面板中(水平、垂直、滚动等),您可以在服务器处理程序中为表单提交执行以下操作

app = UiApp.getActiveApplication().remove(0);
/*add whatever you want here using app */
return app;

这将删除应用程序(面板)中的第一项,并允许您添加任何内容。您还可以将客户端处理程序与最初不可见的项目一起使用。提交时,隐藏表单并显示一条消息,直到服务器处理程序返回。

不幸的是,没有办法刷新页面。

编辑: 添加我在评论中写的内容,以便阅读:

我通常设置我的方式,doGet 和处理程序都调用另一个函数,其中包含新/当前应用程序的参数以及我的列表框具有的任何值。例如,

function doGet(e){
    return actuallyCreateGadget(UiApp.createApplication(), "default value for listbox");
}
function actuallyCreateGadget(app, selectedValue){
    //do stuff here and finish by returning app
}
function serverHandlerFunction(e){
    return actuallyCreateGadget(UiApp.getActiveApplication().remove(0), e.parameter.lbFirst);
}
于 2012-10-30T22:13:35.223 回答