js: Use the last button instead of the first one for form submits

refs #8369
fixes #9245
This commit is contained in:
Johannes Meyer 2015-08-20 14:40:05 +02:00
parent e3d99cb00d
commit fedda16bd4
1 changed files with 3 additions and 3 deletions

View File

@ -227,11 +227,11 @@
icinga.logger.debug('events/submitForm: Button is event.currentTarget');
}
if ($el && ($el.is('input[type=submit]') || $el.is('button[type=submit]'))) {
if ($el && ($el.is('input[type=submit]') || $el.is('button[type=submit]')) && $el.is(':focus')) {
$button = $el;
} else {
icinga.logger.debug(
'events/submitForm: Can not determine submit button, using the first one in form'
'events/submitForm: Can not determine submit button, using the last one in form'
);
}
}
@ -251,7 +251,7 @@
}
if ($button.length === 0) {
$button = $('input[type=submit]', $form).add('button[type=submit]', $form).first();
$button = $('button[type=submit]', $form).add('input[type=submit]', $form).last();
}
if ($button.length) {