Merge branch 'MDL-76667-401' of https://github.com/paulholden/moodle into MOODLE_401_STABLE

This commit is contained in:
Ilya Tregubov
2022-12-22 12:27:51 +07:00
3 changed files with 8 additions and 7 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -5
View File
@@ -269,13 +269,13 @@ export default class ModalForm {
*/
notifyResetFormChanges() {
const form = this.getFormNode();
FormEvents.notifyFormSubmittedByJavascript(this.getFormNode(), true);
if (!form) {
return;
}
FormChangeChecker.resetFormDirtyState(this.getFormNode());
FormEvents.notifyFormSubmittedByJavascript(form, true);
FormChangeChecker.resetFormDirtyState(form);
}
/**
@@ -358,7 +358,8 @@ export default class ModalForm {
this.disableButtons();
// Convert all the form elements values to a serialised string.
const formData = this.modal.getRoot().find('form').serialize();
const form = this.modal.getRoot().find('form');
const formData = form.serialize();
// Now we can continue...
Ajax.call([{
@@ -379,7 +380,7 @@ export default class ModalForm {
} else {
// Form was submitted properly. Hide the modal and execute callback.
const data = JSON.parse(response.data);
this.notifyResetFormChanges();
FormChangeChecker.markFormSubmitted(form[0]);
const event = this.trigger(this.events.FORM_SUBMITTED, data);
if (!event.defaultPrevented) {
this.modal.hide();