Skip to content

Commit 29692d0

Browse files
muratcakirMichael-Herzog
authored andcommitted
Enhanced disableSubmitTemporarily
1 parent 08b643b commit 29692d0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/Smartstore.Web/wwwroot/js/smartstore.common.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@
447447
return $('meta[name="__rvt"]').attr("content") || $('input[name="__RequestVerificationToken"]').val();
448448
};
449449

450+
window.disableSubmitTemporarily = function (form, duration = 4000) {
451+
if (!form) return;
452+
453+
const submitButtons = form.querySelectorAll('button[type="submit"], input[type="submit"]');
454+
submitButtons.forEach(btn => {
455+
btn.disabled = true;
456+
setTimeout(() => {
457+
try { btn.disabled = false; } catch { }
458+
}, duration);
459+
});
460+
}
461+
450462
/**
451463
* Render a JSON object as an HTML tree using <div> rows.
452464
* - One <div> per entry/row.

0 commit comments

Comments
 (0)