button _also_ does sumbit??
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julius 2022-06-28 19:52:11 +02:00
parent 5e6537e92c
commit 55bd482551
Signed by: j00lz
GPG key ID: AF241B0AA237BBA2

View file

@ -125,19 +125,16 @@
return data; return data;
}).then(set_state); }).then(set_state);
} }
function return_handler(e) { function return_handler(e) {
e.preventDefault(); e.preventDefault();
console.log("wario");
let code = document.getElementById("student_number").value; let code = document.getElementById("student_number").value;
console.log(code); console.log(code);
scan_ticket(code); scan_ticket(code);
document.getElementById("student_number").value = ""; document.getElementById("student_number").value = "";
} }
function button_click_handler() {
let code = document.getElementById("student_number").value;
scan_ticket(code);
}
document.getElementById("add_student").addEventListener("click", button_click_handler);
document.getElementById("student_number_wrapper").addEventListener("submit", return_handler); document.getElementById("student_number_wrapper").addEventListener("submit", return_handler);
document.getElementById("start_scan_btn").addEventListener('click', start_scanning); document.getElementById("start_scan_btn").addEventListener('click', start_scanning);
@ -255,5 +252,10 @@
document.getElementById("file-selector-button").addEventListener("click", upload_csv); document.getElementById("file-selector-button").addEventListener("click", upload_csv);
let elem = document.getElementById("student_number");
elem.focus();
elem.select();
</script> </script>
{% endblock %} {% endblock %}