I am trying to complete a form created in google app script web app via URL with the intention to display the field but be inactive and a UUID for form submit.
In web app testing the form is completed by URL eg: https://script.google.com/macros/s/AKfycbwam4eZHPrs2ooVQLzJZgMcFb9gfXC2OPSq8f7Xkp9z/dev?fn=bob filling "bob" into field "fn".
However to remove googles "This application was created by another user, not by Google.Terms of Service" we put the web app in and iframe or link in google sites. This throws a spanner in the works.
Any advise will be much appreciated
function doGet() {
return HtmlService.createTemplateFromFile("page").evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
function userClicked(userInfo){
const url = "https://docs.google.com/spreadsheets/d/1-7D4bXhm1Yx0ekRUmrwr8fTsdQ0dLtMI4gYG-THPUdk/edit#gid=0";
const ss = SpreadsheetApp.openByUrl(url);
const ws = ss.getSheetByName("data");
ws.appendRow([userInfo.firstName,userInfo.lastName,userInfo.app,new Date()])
// Logger.log(name + " Clicked The Button");
}
function include(filename){
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
<script>
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('select');
var instances = M.FormSelect.init(elems);
});
document.getElementById("btn").addEventListener("click",doStuff);
function doStuff(){
const userInfo = {};
userInfo.firstName = document.getElementById("fn").value;
userInfo.lastName = document.getElementById("ln").value;
userInfo.app = document.getElementById("app").value;
google.script.run.userClicked(userInfo);
document.getElementById("fn").value = "";
document.getElementById("ln").value = "";
var myApp = document.getElementById("app");
myApp.selectedIndex = 0;
M.FormSelect.init(myApp);
}
</script>
<script>
google.script.url.getLocation(function(location){
document.getElementById('fn').value = location.parameters.fn[0]
document.getElementById('ln').value = location.parameters.ln[0]
})
</script>