Garmaine Staff asked 2 years ago

I am wondering if is possible to close the htmlservice popup when the submit button is hit on the Google form

function launchForm() {
  var form = FormApp.openById('15Qw9jmolybvMbx2d3UhddEWHrKe0zBiV5_asKXolsM0');
  var formUrl = form.getPublishedUrl(); 

//  var response = UrlFetchApp.fetch(formUrl);
//  var formHtml = response.getContentText();

  var htmlApp = HtmlService
      .createHtmlOutput('<h1>Your Organization</h1>')
      .append('<iframe src ="' + formUrl + '?embedded=true" width="1000" height="900" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>')
      .setTitle('Form')
      .setWidth(1000) 
      .setHeight(1000);

  SpreadsheetApp.getActiveSpreadsheet().show(htmlApp);
}

I'm hoping that when I hit the submit button on the form, the html app will close