Skip to content

Commit

Permalink
MDL-57097 mod_assign: add event listener to avoid form submit
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Nov 24, 2016
1 parent 0fbe41f commit b6f549d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mod/assign/amd/build/grading_panel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mod/assign/amd/src/grading_panel.js
Expand Up @@ -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));
Expand Down

0 comments on commit b6f549d

Please sign in to comment.