Google apps script runners not calling function

I've been working on the apps script project for a while and it was working fine, but suddenly it no longer sends the form results back to my .gs script. My code takes an html form for user input and feeds it back to my script to do the job. My code is more complex, but the concept is the same as below.

function test()
{
  var html += '<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" />';
  html += "</form>";
  var htmlOutput = HtmlService
     .createHtmlOutput(html)
     .setSandboxMode(HtmlService.SandboxMode.IFRAME)
     .setWidth(450)
     .setHeight(300);
  Logger.log(html);
 SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'enter anything');
}

function printForm(formObject)
{
  Logger.log("hello?");
  Logger.log(formObject.testy);
  SpreadsheetApp.getUi().alert("hello world!");
}

      

My problem is that my printForm function is never called in this case. This used to be used until early this week with no major code changes. No errors are returned, in fact the script is displayed in the execution log.

[15-06-27 15:41:58:645 PDT] Starting execution
[15-06-27 15:41:58:657 PDT] HtmlService.createHtmlOutput([<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" /></form>]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setSandboxMode([IFRAME]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setWidth([450]) [0 seconds]
[15-06-27 15:41:58:659 PDT] HtmlOutput.setHeight([300]) [0 seconds]
[15-06-27 15:41:58:660 PDT] Logger.log([<form id="testform"><input id="testy" type="text" value="enter"><input type="button" value="submit" onclick="google.script.run.printForm();google.script.host.close()" /></form>, []]) [0 seconds]
[15-06-27 15:41:58:660 PDT] SpreadsheetApp.getUi() [0 seconds]
[15-06-27 15:41:58:904 PDT] Ui.showModalDialog([HtmlOutput, Select Your Player to Draft]) [0.243 seconds]
[15-06-27 15:41:58:905 PDT] Execution succeeded [0.248 seconds total runtime]

      

I tore my hair out trying to figure out what has changed, possibly on the google side, why the script runner is not calling my function. Again, this exact test code worked a week ago with a larger project of mine that uses similar concepts.

So far I've tried 4 different browsers, chrome, opera, firefox (which never worked) and IE. Reading around seemed like some problematic firefox and script runners, so it makes sense that it still doesn't work.

My TL; DR: In Google Apps scripting, do you get user input from the html form and pass it back to the server-side script page if the code above doesn't work?

EDIT: View Apps - script. Problems with Sandy Good. I'm not the only one with the script runners issue suddenly not working. I update every time I find out more.

+3


source to share





All Articles