fix: modal save button + missing translations

- Replace form="id" cross-element approach with requestSubmit() for
  reliable save button wiring in modal footer
- Re-call _bindDirty after validation-error re-render so dirty guard
  is preserved across save attempts
- Translate missing Dutch strings: Order saved, Error saving order,
  Question details, View
This commit is contained in:
2026-07-06 22:41:34 +02:00
parent 4a87ac574d
commit 3b6ff680e5
4 changed files with 26 additions and 3 deletions
@@ -56,6 +56,12 @@ export default class extends Controller {
_bindForm(url) {
const form = this.modalBodyTarget.querySelector('form');
if (!form) return;
if (this.hasModalFooterTarget) {
const saveBtn = this.modalFooterTarget.querySelector('[type="submit"]');
saveBtn?.addEventListener('click', () => form.requestSubmit(), {once: true});
}
form.addEventListener('submit', async (e) => {
e.preventDefault();
const res = await fetch(url, {
@@ -69,6 +75,7 @@ export default class extends Controller {
} else {
this.modalBodyTarget.innerHTML = await res.text();
this._moveFooter();
this._bindDirty();
this._bindForm(url);
}
}, {once: true});