From eca31040afc2502d25630f7b22b9589c4fbfab81 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Fri, 13 Mar 2026 15:18:09 +1100 Subject: [PATCH] Update DIY HTMX to trigger on input update --- app/templates/_layout.html | 8 ++++++++ app/templates/partials/dashboard_graph.html | 8 -------- app/templates/partials/dashboard_table.html | 8 -------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/templates/_layout.html b/app/templates/_layout.html index cab58e9..b714c67 100644 --- a/app/templates/_layout.html +++ b/app/templates/_layout.html @@ -227,6 +227,14 @@ } }); + // Auto-submit forms when inputs change + document.addEventListener('change', (e) => { + const htmxForm = e.target.closest('form[hx-get], form[hx-post]'); + if (htmxForm) { + htmxForm.dispatchEvent(new Event('submit', { cancelable: true, bubbles: true })); + } + }); + // Handle form submissions for Micro-HTMX document.addEventListener('submit', async (e) => { const htmxForm = e.target.closest('form[hx-get], form[hx-post]'); diff --git a/app/templates/partials/dashboard_graph.html b/app/templates/partials/dashboard_graph.html index fbefec4..d8af6bf 100644 --- a/app/templates/partials/dashboard_graph.html +++ b/app/templates/partials/dashboard_graph.html @@ -29,14 +29,6 @@ - - -
- -
diff --git a/app/templates/partials/dashboard_table.html b/app/templates/partials/dashboard_table.html index 2712a5d..f05c8ee 100644 --- a/app/templates/partials/dashboard_table.html +++ b/app/templates/partials/dashboard_table.html @@ -16,14 +16,6 @@ - - -
- -