Fix purchase form logic
Django CI/CD / test (push) Successful in 26s
Django CI/CD / build-and-push (push) Has been skipped

This commit is contained in:
2026-01-16 22:15:07 +01:00
parent c684d833ef
commit 3e8c842047
4 changed files with 25 additions and 19 deletions
+3 -14
View File
@@ -25,18 +25,7 @@ function setupElementHandlers() {
document.addEventListener("DOMContentLoaded", setupElementHandlers);
document.addEventListener("htmx:afterSwap", setupElementHandlers);
getEl("#id_type").onchange = () => {
getEl("#id_type").addEventListener("change", () => {
setupElementHandlers();
};
document.body.addEventListener("htmx:beforeRequest", function (event) {
// Assuming 'Purchase1' is the element that triggers the HTMX request
if (event.target.id === "id_games") {
var idEditionValue = document.getElementById("id_games").value;
// Condition to check - replace this with your actual logic
if (idEditionValue != "") {
event.preventDefault(); // This cancels the HTMX request
}
}
});
}
);