MDL-57097 mod_assign: add event listener to avoid form submit

This commit is contained in:
Simey Lameze 2016-11-24 11:24:25 +08:00
parent 0fbe41f4cd
commit b6f549d139
2 changed files with 6 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -347,6 +347,11 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
*/
GradingPanel.prototype.registerEventListeners = function() {
var docElement = $(document);
var region = $(this._region);
// Add an event listener to prevent form submission when pressing enter key.
region.on('submit', 'form', function(e) {
e.preventDefault();
});
docElement.on('user-changed', this._refreshGradingPanel.bind(this));
docElement.on('save-changes', this._submitForm.bind(this));