FIX Prevent the CMS Hijacking the return keypress in gridfieldaddbydbfield

This commit is contained in:
micmania1 2016-02-04 23:53:46 +00:00
parent 9526e13e5c
commit 2c0e1a73ed
2 changed files with 22 additions and 1 deletions

View File

@ -147,6 +147,8 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
*/
public function getHTMLFragments($gridField)
{
Requirements::javascript(BLOGGER_DIR . '/js/gridfieldaddbydbfield.js');
/**
* @var DataList $dataList
*/
@ -184,7 +186,6 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
'add',
'add'
);
$addAction->setAttribute('data-icon', 'add');
$forTemplate = new ArrayData(array());

View File

@ -0,0 +1,20 @@
(function ($) {
$.entwine('ss', function ($) {
/**
* Prevent the CMS hijacking the return key
*/
$('.add-existing-autocompleter input.text').entwine({
'onkeydown': function (e) {
if(e.which == 13) {
$parent = $(this).parents('.add-existing-autocompleter');
$parent.find('button[type="submit"]').click();
return false;
}
}
});
});
})(jQuery);