From 20ec8ac96970bfa8733ab4966238b690e111b3f7 Mon Sep 17 00:00:00 2001 From: Mayurrajsinh Rathod Date: Fri, 29 Dec 2023 16:37:34 +0530 Subject: [PATCH] [FIX] survey: single line input on 'enter' key Steps to reproduce =================== 1. Create single-line questions like numbers and single-line text. 2. Test the survey. 3. Press the 'enter' key on a single line input. ->The form reloads and does not submit. Technical ========== With commit https://github.com/odoo/odoo/commit/7109f480ec27e929a43c4bae78912bad42458e90, a next button is added before the submit button, so when you press enter on single-line questions the first button of the form is clicked which refreshes the page without any action. Ref-https://github.com/odoo/odoo/blob/66b4e080e29551d1c74cdc4b3d9ccba92ce81dd1/addons/survey/static/src/js/survey_form.js#L116 After this commit ================= We can submit the form with the 'enter' key from single-line input. Task-3650231 closes odoo/odoo#149003 Signed-off-by: Thibault Delavallee (tde) --- addons/survey/static/src/js/survey_form.js | 1 + addons/survey/views/survey_templates.xml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/survey/static/src/js/survey_form.js b/addons/survey/static/src/js/survey_form.js index c08339bbeaf..5aadd59b6b0 100644 --- a/addons/survey/static/src/js/survey_form.js +++ b/addons/survey/static/src/js/survey_form.js @@ -1141,6 +1141,7 @@ publicWidget.registry.SurveyFormWidget = publicWidget.Widget.extend(SurveyPreloa // Make the form completely readonly const form = document.querySelector('form'); form.querySelectorAll('input, textarea, label, td')?.forEach(node => { + node.blur(); node.classList.add("pe-none"); }); // Replace the Submit button by a Next button diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index 8600876f89f..3a9c8094898 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -192,8 +192,8 @@
- + or press Enter @@ -213,12 +213,12 @@
- + or press Enter
@@ -253,12 +253,12 @@
- + or press Enter