From ed281d89dd69b5dbd272c3034cf542bae792a152 Mon Sep 17 00:00:00 2001 From: j3nsch Date: Mon, 21 Oct 2024 10:57:41 +0200 Subject: [PATCH] #1243 Prevent ENTER in text input elements to trigger submit --- public/layouts/opus4/js/submit.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/public/layouts/opus4/js/submit.js b/public/layouts/opus4/js/submit.js index 82528de6fd..a95bc5d00e 100644 --- a/public/layouts/opus4/js/submit.js +++ b/public/layouts/opus4/js/submit.js @@ -23,12 +23,8 @@ * along with OPUS; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * @category Application - * @author Sascha Szott - * @copyright Copyright (c) 2008-2012, OPUS 4 development team + * @copyright Copyright (c) 2008, OPUS 4 development team * @license http://www.gnu.org/licenses/gpl.html General Public License - * @version $Id$ - * */ $(function () { @@ -40,4 +36,12 @@ $(function () { }); }); + $('form').on('keydown', e => { + if (e.key === 'Enter') { + if ($(e.target).is("input[type='text']")) { + e.preventDefault(); + } + } + }); + }); \ No newline at end of file