I've been using this script to create this web app. It's supposed to take in a form submission and transfer the data to a google sheet. Once it's done that, it should clear the fields and start over. This one works (for the most part).
I tried to clean up the script by adding includes in the Code.gs file. Once I changed the script to this to create the same web app, I get this as a result (you have to actually submit something to see it). Once you click submit, nothing runs, and the page switches to some crazy web address.
I'm pretty sure the problem is the difference between this (the original Code.gs):
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('Index')
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
}
and this (the new Code.gs):
function doGet(request) {
return HtmlService.createTemplateFromFile('Index')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
I just don't know enough to see the problem.
You're using Logger.log() statements inside the javascript tags. They're specific to google script so will not work outside of it.
Disabling them made the form work.