Fixed paths in main.js and added toggleOtherField function
This commit is contained in:
parent
799e29af24
commit
0685312a84
|
|
@ -1,6 +1,6 @@
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
// 🚀 Automatically load existing responses if available
|
// 🚀 Automatically load existing responses if available
|
||||||
fetch("load-responses.php")
|
fetch("./load-responses.php")
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => prepopulateForm(data))
|
.then(data => prepopulateForm(data))
|
||||||
.catch(error => console.error("Failed to load form responses:", error));
|
.catch(error => console.error("Failed to load form responses:", error));
|
||||||
|
|
@ -11,7 +11,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
|
||||||
const formData = new FormData(this);
|
const formData = new FormData(this);
|
||||||
|
|
||||||
fetch("submit.php", {
|
fetch("./submit.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
|
|
@ -95,3 +95,11 @@ function toggleDependentFields() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleOtherField(checkbox, targetId) {
|
||||||
|
let target = document.getElementById(targetId);
|
||||||
|
if (target) {
|
||||||
|
target.style.display = checkbox.checked ? "block" : "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue