Pressing enter on a modal form now does the right thing

This commit is contained in:
Oliver 2018-04-30 21:56:36 +10:00
parent 37b109b8fc
commit b2bb1ea1fe

View File

@ -103,6 +103,17 @@ function launchModalForm(modal, url, options = {}) {
$(modal + ' .modal-form-content').scrollTop(0);
});
// Prevent 'enter' key from submitting the form using the normal method
$(modal).on('keydown', '.js-modal-form', function(event) {
if (event.keyCode == 13) {
event.preventDefault();
$(modal).find("#modal-form-submit").click();
return false;
}
});
ajax_data = {
url: url,
type: 'get',