Fix form submit when using keyboard shortcuts

This commit is contained in:
Frederic Guillot 2017-01-28 16:44:10 -05:00
parent 522ceae6bb
commit 58fac9b1be
3 changed files with 15 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,15 +10,17 @@ KB.keyboardShortcuts = function () {
}
function submitForm() {
var forms = $("form");
if (KB.modal.isOpen()) {
KB.modal.submitForm();
} else {
var forms = $("form");
if (forms.length == 1) {
forms.submit();
} else if (forms.length > 1) {
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
$(document.activeElement).parents("form").submit();
} else if (KB.modal.isOpen()) {
KB.modal.getForm().submit();
if (forms.length == 1) {
forms.submit();
} else if (forms.length > 1) {
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
$(document.activeElement).parents("form").submit();
}
}
}
}

View File

@ -167,6 +167,7 @@
replace(response);
});
},
getForm: getForm
getForm: getForm,
submitForm: submitForm
};
}());