I've made a google script which I've published as a web app. I want the "myFunction()" to be called when I press the submit button on the web app. The following doesn't seem to work, and I can't really tell why:
google script file:
function doGet() {
return HtmlService.createHtmlOutputFromFile('index');
}
function myFunction() {
//does some stuff
}
html file:
<html>
<head>
<script src="Code.gs"></script>
</head>
<body>
<form name="myform">
<!-- some input stuff goes here -->
<input name="Submit" type="submit" value="Update" onclick="myFunction()" />
</form>
</body>
</html>
Code.gsin the same directory as your HTML file (if not, it will not be included). Put a testalert()orconsole.log()as the very first line inmyFunction(), to see if the function is actually getting called.