From 434c273fafbd2bf069053fb2f70395281f47f924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Marie=CC=81thoz?= Date: Tue, 16 Mar 2021 11:16:18 +0100 Subject: [PATCH] editor: prevent the enter key to submit the form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Prevents the enter key to submit the form in some fields that may be filled though a scanning device. * Closes #1421. Co-Authored-by: Johnny MariƩthoz --- .../document_identified_by-v0.0.1.json | 3 +- .../ill_requests/ill_request-v0.0.1.json | 7 +++- .../templates/rero_ils/ill_request_form.html | 24 +++++++++++-- .../items/jsonschemas/items/item-v0.0.1.json | 3 +- .../jsonschemas/patrons/patron-v0.0.1.json | 6 ++++ .../theme/assets/js/reroils/ills_request.js | 36 +++++++++++++++++++ rero_ils/theme/assets/js/reroils/public.js | 2 +- 7 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 rero_ils/theme/assets/js/reroils/ills_request.js diff --git a/rero_ils/modules/documents/jsonschemas/documents/document_identified_by-v0.0.1.json b/rero_ils/modules/documents/jsonschemas/documents/document_identified_by-v0.0.1.json index ee5e1ae91b..e49495a055 100644 --- a/rero_ils/modules/documents/jsonschemas/documents/document_identified_by-v0.0.1.json +++ b/rero_ils/modules/documents/jsonschemas/documents/document_identified_by-v0.0.1.json @@ -153,7 +153,8 @@ "minLength": 1, "form": { "templateOptions": { - "itemCssClass": "col-lg-6" + "itemCssClass": "col-lg-6", + "doNotSubmitOnEnter": true } } }, diff --git a/rero_ils/modules/ill_requests/jsonschemas/ill_requests/ill_request-v0.0.1.json b/rero_ils/modules/ill_requests/jsonschemas/ill_requests/ill_request-v0.0.1.json index 4d9cbe82a9..90f495a0ee 100644 --- a/rero_ils/modules/ill_requests/jsonschemas/ill_requests/ill_request-v0.0.1.json +++ b/rero_ils/modules/ill_requests/jsonschemas/ill_requests/ill_request-v0.0.1.json @@ -200,7 +200,12 @@ }, "identifier": { "type": "string", - "title": "Identifier" + "title": "Identifier", + "form": { + "templateOptions": { + "doNotSubmitOnEnter": true + } + } }, "source": { "type": "object", diff --git a/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html b/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html index e029e6a2f1..fcf3f59b10 100644 --- a/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html +++ b/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html @@ -27,7 +27,7 @@

{{ _('Caution!') }}

{{ _('A well detailed request is more likely to be satisfied') }}

-
+ {{ form.hidden_tag() }} {%- if form.csrf_token and form.csrf_token.errors %}