mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 00:20:37 +01:00
MDL-76667 forms: mark modal form as submitted upon success.
Ensure the form change checker module doesn't warn user about it.
This commit is contained in:
parent
6b24f59302
commit
0d20d1e8aa
2
lib/form/amd/build/modalform.min.js
vendored
2
lib/form/amd/build/modalform.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user