Skip to content Skip to sidebar Skip to footer

Html Service Submit Form Not Calling Google.script.run Function

I have a script that used to work just fine, but has suddenly stopped working. The user selects an option from a user-created menu, which launches a dialog box (HTML Service form)

Solution 1:

The parameter for withSuccessHandler() (and withFailureHandler()) is supposed to be a callback function. You've provided something that isn't a function: google.script.host.close(). Since you've included the parentheses, close() gets executed first, to obtain a return value for withSuccessHandler(). That closes the dialog, and halts the client-side JavaScript.

You just need to remove the parentheses, referring to the function by name only:

<input type="submit" value="Submit"class="submit" 
 onclick="google.script.run
                       .withSuccessHandler(google.script.host.close)
                       .createAgenda(this.parentNode)"/>

Post a Comment for "Html Service Submit Form Not Calling Google.script.run Function"