fix missing link create datastores on the first page.
This commit is contained in:
parent
4dfac80fde
commit
56458c4451
15
index.html
15
index.html
|
|
@ -11,6 +11,9 @@
|
|||
<h2> first set up your microscope and sample preparation </h2>
|
||||
<a href="setup_microscope.html">setup your microscope and camera here</a><br>
|
||||
<a href="sample_prep_protocol.html">add a sample preparation protocol</a><br>
|
||||
<h2> then you can start taking in samples </h2>
|
||||
<a href="sample_intake.html">setup your microscope and camera here</a><br>
|
||||
|
||||
<h2> then you can start observing </h2>
|
||||
<a href="observe_main.html">filamentous and protozoa</a><br>
|
||||
<a href="observe_nema.html">nematodes</a><br>
|
||||
|
|
@ -21,3 +24,15 @@
|
|||
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
var db;
|
||||
let openRequest = indexedDB.open("my_db");
|
||||
|
||||
openRequest.onupgradeneeded = function() {
|
||||
db = openRequest.result;
|
||||
db.createObjectStore("microscope_setup", {autoIncrement : true});
|
||||
db.createObjectStore("prep_protocol", {autoIncrement : true});
|
||||
db.createObjectStore("sample", {autoIncrement : true});
|
||||
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<h1>Add Sample</h1>
|
||||
<form class="needs-validation" name = "sample" method="post">
|
||||
<form class="needs-validation" id = "sample">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label class = "form-label" for="name">
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
<input class="form-control" name="location" value=""></input>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary float-end" onclick="add();"> submit </button>
|
||||
<button class="btn btn-primary float-end" type="submit"> submit </button>
|
||||
|
||||
<div id="map"></div>
|
||||
</form>
|
||||
|
|
@ -97,14 +97,6 @@
|
|||
var db;
|
||||
let openRequest = indexedDB.open("my_db");
|
||||
|
||||
openRequest.onupgradeneeded = function() {
|
||||
db = openRequest.result;
|
||||
db.createObjectStore("microscope_setup", {autoIncrement : true});
|
||||
db.createObjectStore("prep_protocol", {autoIncrement : true});
|
||||
db.createObjectStore("sample", {autoIncrement : true});
|
||||
|
||||
};
|
||||
|
||||
openRequest.onerror = function() {
|
||||
console.error("Error", openRequest.error);
|
||||
};
|
||||
|
|
@ -113,8 +105,11 @@
|
|||
db = openRequest.result;
|
||||
// continue working with database using db object
|
||||
};
|
||||
function add(e){
|
||||
e.preventDefault();
|
||||
|
||||
const form = document.getElementById("sample");
|
||||
form.addEventListener("submit", add);
|
||||
|
||||
function add(event){
|
||||
let sample = {
|
||||
"Name" : document.getElementById("Name").value,
|
||||
"Type" : document.getElementById("Type").value,
|
||||
|
|
@ -133,6 +128,8 @@
|
|||
console.log("something went wrong");
|
||||
// Don't forget to handle errors!
|
||||
};
|
||||
event.preventDefault();
|
||||
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue