Merge branch 'MDL-86455' of https://github.com/yerairogo/moodle into main

This commit is contained in:
Paul Holden
2025-10-20 16:51:03 +01:00
3 changed files with 11 additions and 5 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+9 -3
View File
@@ -328,9 +328,13 @@ export default class ModalForm {
formData = formData + '&' + encodeURIComponent(button.getAttribute('name')) + '=' +
encodeURIComponent(button.getAttribute('value'));
this.disableButtons();
const bodyContent = this.getBody(formData);
this.modal.setBodyContent(bodyContent);
bodyContent.catch(Notification.exception);
bodyContent
.then(() => this.enableButtons())
.catch(Notification.exception);
}
/**
@@ -358,14 +362,16 @@ export default class ModalForm {
* Disable buttons during form submission
*/
disableButtons() {
this.modal.getFooter().find('[data-action]').attr('disabled', true);
this.modal.getModal()[0].querySelectorAll('input[type="submit"], [data-action]')
.forEach(el => el.setAttribute('disabled', true));
}
/**
* Enable buttons after form submission (on validation error)
*/
enableButtons() {
this.modal.getFooter().find('[data-action]').removeAttr('disabled');
this.modal.getModal()[0].querySelectorAll('input[type="submit"], [data-action]')
.forEach(el => el.removeAttribute('disabled'));
}
/**