Skip to content

Commit 0db333e

Browse files
rafizamankhanchriscarrollsmith
authored andcommitted
fix create role modal form reset
1 parent b3561fb commit 0db333e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

static/js/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ document.body.addEventListener('htmx:configRequest', function() {
2020
// Global handler: when a server response includes HX-Trigger: modalDismiss,
2121
// clean up any Bootstrap modal backdrop left behind by OOB swaps that
2222
// replaced the modal element before afterRequest could call .hide().
23+
document.body.addEventListener('hidden.bs.modal', function(event) {
24+
var modal = event.target;
25+
if (modal.id && modal.id.startsWith('create')) {
26+
var form = modal.querySelector('form');
27+
if (form) { form.reset(); }
28+
}
29+
});
30+
2331
document.body.addEventListener('modalDismiss', function() {
2432
document.querySelectorAll('.modal.show').forEach(function(el) {
2533
var modal = bootstrap.Modal.getInstance(el);

0 commit comments

Comments
 (0)