update sample prep intake to work like it should.

This commit is contained in:
lukas fricke 2025-01-17 02:38:20 +01:00
parent 56458c4451
commit b813e80232

View file

@ -7,7 +7,7 @@
<body> <body>
<div class="container"> <div class="container">
<form class="needs-validation" name = "sample"> <form class="needs-validation" id = "sample">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<label class = "form-label" for="name"> <label class = "form-label" for="name">
@ -73,7 +73,7 @@
</textarea> </textarea>
</div> </div>
</div> </div>
<button class="btn btn-primary float-end" onclick="add();">submit</button> <button class="btn btn-primary float-end" type="submit">submit</button>
</form> </form>
</div> </div>
</body> </body>
@ -97,8 +97,12 @@
db = openRequest.result; db = openRequest.result;
// continue working with database using db object // 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 prep_protocol = { let prep_protocol = {
"name" : document.getElementById("name").value, "name" : document.getElementById("name").value,
"Sample_Size" : document.getElementById("Sample_Size").value, "Sample_Size" : document.getElementById("Sample_Size").value,
@ -116,6 +120,8 @@
console.log("something went wrong"); console.log("something went wrong");
// Don't forget to handle errors! // Don't forget to handle errors!
}; };
event.preventDefault();
return false; return false;
} }