MDL-80608 core_form: Fire modal form event for errors in definition
The ERROR event is defined as being fired if an exception occurs while contacting the server. This change ensures it is fired for exceptions in the form definition AJAX request, not just form submission. Additionally, if such an error occurs in submission, the form buttons were left in disabled state. This change makes them enabled again.
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -266,11 +266,12 @@ export default class ModalForm {
|
||||
.then(response => {
|
||||
pendingPromise.resolve();
|
||||
return {html: response.html, js: Fragment.processCollectedJavascript(response.javascript)};
|
||||
});
|
||||
})
|
||||
.catch(exception => this.onSubmitError(exception));
|
||||
}
|
||||
|
||||
/**
|
||||
* On exception during form processing. Caller may override
|
||||
* On exception during form processing or initial rendering. Caller may override.
|
||||
*
|
||||
* @param {Object} exception
|
||||
*/
|
||||
@@ -409,7 +410,10 @@ export default class ModalForm {
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.catch(exception => this.onSubmitError(exception));
|
||||
.catch(exception => {
|
||||
this.enableButtons();
|
||||
this.onSubmitError(exception);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user