Hi.
My web page has a HTML search box, and a Google Sheet. The user inputs their search into the HTML box:
//Apps script:
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('searchbox').setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
//html/searchbox
<!DOCTYPE html>
<html>
<form>
<input type="search" id="q" name="submit" placeholder="Search for song name..." required>
<button onclick="bclick(q.value)">Search</button />
</form>
<script type="text/javascript">
function bclick(q) {
google.script.run.afterhtml(q);
}
</script>
</html>
I have 3 problems;
1..when the searchbox button is pressed, the searchbox script ends, and the box dissappears - it would preferably stay.
2..Once the search has completed, the sheet is updated, but unless the user manually updates the page, they cant see the results (the sheet is dynamically created, so is not attached to the script)
3..In order to refresh the page, it seems I need to run another HtmlService but I havent been able to do this outside of the doget() function.
As usual, Ive asked my friend Google, but havent been able to find anything that seems to work. There were suggestions of
window.location.reload(true);
Appreciate,
Al.