mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-07 08:00:15 +02:00
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:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user