some minor changes
This commit is contained in:
parent
57161cbc2d
commit
1c3264f9cb
|
|
@ -67,7 +67,7 @@
|
|||
<label class = "form-label" for="location">Location of Sample</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input class="form-control" name="location" value=""></input>
|
||||
<input class="form-control" name="location" id="Location" value=""></input>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary float-end" type="submit"> submit </button>
|
||||
|
|
@ -76,6 +76,7 @@
|
|||
</form>
|
||||
<script>
|
||||
var map = L.map('map').fitWorld();
|
||||
var sample_form = document.getElementById("sample");
|
||||
L.tileLayer(
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
{attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
|
|
@ -85,7 +86,7 @@
|
|||
map.on('click', function(ev){
|
||||
var latlng = map.mouseEventToLatLng(ev.originalEvent);
|
||||
console.log(latlng.lat + ', ' + latlng.lng);
|
||||
document.sample.location.value = latlng.lat + ', ' + latlng.lng;
|
||||
sample_form.location.value = latlng.lat + ', ' + latlng.lng;
|
||||
if (marker != undefined) {
|
||||
map.removeLayer(marker);
|
||||
};
|
||||
|
|
@ -109,13 +110,15 @@
|
|||
|
||||
const form = document.getElementById("sample");
|
||||
form.addEventListener("submit", add);
|
||||
|
||||
|
||||
function add(event){
|
||||
event.preventDefault();
|
||||
|
||||
let sample = {
|
||||
"Name" : document.getElementById("Name").value,
|
||||
"Type" : document.getElementById("Type").value,
|
||||
"Date_Collected" : document.getElementById("Date_Collected").value,
|
||||
"Place" : document.getElementById("Place").value,
|
||||
"Place" : document.getElementById("Location").value,
|
||||
"Notes" : document.getElementById("Notes").value
|
||||
}
|
||||
let transaction = db.transaction(["sample"], "readwrite");
|
||||
|
|
@ -129,7 +132,6 @@
|
|||
console.log("something went wrong");
|
||||
// Don't forget to handle errors!
|
||||
};
|
||||
event.preventDefault();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue