Closing An App Script Sidebar Containing A Form
I have a Google Apps Script running a html-form in the sidebar. The form-answers are used to generate documents. My problem is that I want to close the sidebar when the program has
Solution 1:
The onclick() attribute can have multiple functions in it. You can put the google.script.host.close() statement after all the code. Just make sure to put a semi-colon at the end of all the google.script.run stuff:
<input type="button" value="Submit" 
  onclick="google.script.run.withFailureHandler(fail)
  .doStuff(this.parentNode); google.script.host.close();"/>
Your packing a lot of code into the onclick() attribute. You could have a separate function:
onclick="serverCall();"window.serverCall = function() {
  google.script.run
    .withFailureHandler(fail)
    .doStuff(this.parentNode);
  google.script.host.close();
};
Post a Comment for "Closing An App Script Sidebar Containing A Form"