fix(frontend): reset form selections when modifying parent form

This commit is contained in:
Mariano Riefolo 2024-09-07 13:45:10 +02:00
parent 82cba2e2c3
commit 337bd3a900

View File

@ -145,12 +145,24 @@ function make_table(url) {
function select_pdf() { function select_pdf() {
Cookies.set("id", document.getElementById("links").value); Cookies.set("id", document.getElementById("links").value);
reset_forms();
document.getElementById("type").value = "none";
document.getElementById("form-teacher").setAttribute("hidden", "");
document.getElementById("form-classes").setAttribute("hidden", "");
document.getElementById("form-type").removeAttribute("hidden"); document.getElementById("form-type").removeAttribute("hidden");
} }
function reset_forms() {
document.getElementById("year").value = "none";
document.getElementById("section").value = "none";
document.getElementById("major").value = "none";
document.getElementById("teacher").value = "";
}
function select_type() { function select_type() {
let id = document.getElementById("links").value; let id = document.getElementById("links").value;
let value = document.getElementById("type").value; let value = document.getElementById("type").value;
reset_forms();
if (value === "teacher") { if (value === "teacher") {
load_teachers(id); load_teachers(id);
document.getElementById("form-teacher").removeAttribute("hidden"); document.getElementById("form-teacher").removeAttribute("hidden");