Simple popup or dialog box in Google Apps Script

前端 未结 4 1894
情深已故
情深已故 2021-01-12 18:29

I\'m looking for simple code that adds a popup in my Google Apps Script Ui that comes up when I hit a submit button. The popup box would display a message and have a button

4条回答
  •  走了就别回头了
    2021-01-12 19:11

    You can use a dialogbox to popup. Add a button to the dialog-box. Add a client handler that sets the dialog box invisible,once you click the button.

    var app = UiApp.createApplication;
    var dialog = app.createDialogBox();
    var closeHandler = app.createClientHandler().forTargets(dialog).setVisible(false);
    
    var button= app.createButton('Close').addClickHandler(closeHandler);
    
    dialog.add(button);
    app.add(dialog);
    

    This should help.

    EDIT

    Added "()" after .createClientHandler. That should remove issues related to TypeError: Cannot find function createDialogBox in object function createApplication() {/* */}

提交回复
热议问题