internal/gaby: clear old result when new query is made

Clear old results/errors on submit of a new query for the Gaby
webpages.

Updates golang/oscar#55

Change-Id: Iaa2662a7c7fd11b14ebcd661494ee6ed1c6cf617
Reviewed-on: https://go-review.googlesource.com/c/oscar/+/631655
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/internal/gaby/tmpl/actionlog.tmpl b/internal/gaby/tmpl/actionlog.tmpl
index 28bbe93..ea46f1c 100644
--- a/internal/gaby/tmpl/actionlog.tmpl
+++ b/internal/gaby/tmpl/actionlog.tmpl
@@ -121,7 +121,7 @@
 </script>
 
 {{if .StartTime}}
-<div class="section">
+<div class="section" id="result">
   <h2>Action Log from {{.StartTime}} to {{.EndTime}}</h2>
 
   {{with .Entries}}
diff --git a/internal/gaby/tmpl/common.tmpl b/internal/gaby/tmpl/common.tmpl
index cfc9c96..6737a9a 100644
--- a/internal/gaby/tmpl/common.tmpl
+++ b/internal/gaby/tmpl/common.tmpl
@@ -119,6 +119,7 @@
   const form = document.getElementById("form");
   form.addEventListener("submit", (event) => {
   document.getElementById("working").innerHTML = "<p style='margin-top:1rem'>Working...</p>"
+  document.getElementById("result").innerHTML = ""
   })
 </script>
 {{end}}
diff --git a/internal/gaby/tmpl/dbviewpage.tmpl b/internal/gaby/tmpl/dbviewpage.tmpl
index 42e133f..d5af5f7 100644
--- a/internal/gaby/tmpl/dbviewpage.tmpl
+++ b/internal/gaby/tmpl/dbviewpage.tmpl
@@ -11,7 +11,7 @@
   <body>
   	{{template "header" .}}
 
-	<div class="section">
+	<div class="section" id="result">
 	{{- with .Error -}}
 		<p>Error: {{.Error}}</p>
 	{{- else with .Result -}}
diff --git a/internal/gaby/tmpl/overviewpage.tmpl b/internal/gaby/tmpl/overviewpage.tmpl
index a66a92e..d1c8ca0 100644
--- a/internal/gaby/tmpl/overviewpage.tmpl
+++ b/internal/gaby/tmpl/overviewpage.tmpl
@@ -46,7 +46,7 @@
 {{end}}
 
 {{define "overview-result"}}
-<div class="section">
+<div class="section" id="result">
 {{- with .Error -}}
 	<p>Error: {{.Error}}</p>
 {{- else with .Result -}}
diff --git a/internal/gaby/tmpl/rulespage.tmpl b/internal/gaby/tmpl/rulespage.tmpl
index 02ea9e8..49a7b10 100644
--- a/internal/gaby/tmpl/rulespage.tmpl
+++ b/internal/gaby/tmpl/rulespage.tmpl
@@ -9,8 +9,8 @@
   <body>
 	{{template "header" .}}
 
-	<div class="section">
-	{{- with .Error -}}ß
+	<div class="section" id="result">
+	{{- with .Error -}}
 		<p>Error: {{.}}</p>
 	{{- else with .Result -}}
 		<div class="metadata">
diff --git a/internal/gaby/tmpl/searchpage.tmpl b/internal/gaby/tmpl/searchpage.tmpl
index 2bb3593..a548a77 100644
--- a/internal/gaby/tmpl/searchpage.tmpl
+++ b/internal/gaby/tmpl/searchpage.tmpl
@@ -13,7 +13,7 @@
 </html>
 
 {{define "search-result"}}
-<div class="section">
+<div class="section" id="result">
 {{- with .Error -}}
 	<p>Error: {{.}}</p>
 {{- else with .Results -}}