#20962: Handling text field keypress events on bulk actions to trigger the expected action.

Work Item: 20962
This commit is contained in:
Sipke Schoorstra
2014-10-20 12:39:12 -07:00
parent fa683f02d9
commit 9a44d09c5e

View File

@@ -74,6 +74,22 @@
$(".check-all").change(function () {
$(this).parents("table.items").find(":checkbox:not(:disabled)").prop('checked', $(this).prop("checked"));
});
// Handle keypress events in bulk action fieldsets that are part of a single form.
// This will make sure the expected action executes when pressing "enter" on a text field.
$("form .bulk-actions").on("keypress", "input[type='text']", function (e) {
if (e.which != 13)
return;
var sender = $(this);
var fieldset = sender.closest("fieldset.bulk-actions");
var submitButton = fieldset.find("button[type='submit']");
if (submitButton.length == 0)
return;
e.preventDefault();
submitButton.click();
});
})(jQuery);