forked from chihacknight/books-to-women-in-prison
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Search.html
57 lines (44 loc) · 1.49 KB
/
Search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
// Prevent forms from submitting.
function preventFormSubmit() {
var forms = document.querySelectorAll('form');
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener('submit', function(event) {
event.preventDefault();
});
}
}
window.addEventListener('load', preventFormSubmit);
function handleFormSubmit(formObject) {
console.info(formObject)
var result = google.script.run.withSuccessHandler(display).processSearch(formObject);
document.getElementById("output").innerHTML = result;
}
function display(searchResult) {
var div = document.getElementById('output');
div.innerHTML = searchResult;
}
function clearSearchResult(){
var div = document.getElementById('output');
div.innerHTML = "";
}
</script>
</head>
<body>
<form onsubmit="handleFormSubmit(this)">
ISBN: <input type="text" name="isbn"> <br>
Title: <input type="text" name="title"> <br>
Description <input type = "text" name = "description"> <br>
Author <input type = "text" name = "author"> <br>
<input type="submit" value="Submit">
</form>
<br>
<input type="submit" value="Clear Search" onclick="clearSearchResult()" />
<input type="submit" value="Close" onclick="google.script.host.close()" />
<div id="output"></div>
</body>
</html>