mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#20962: Handling text field keypress events on bulk actions to trigger the expected action.
Work Item: 20962
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user