From 368c45b0520a273d2303245b3a4e620bc2f7c244 Mon Sep 17 00:00:00 2001 From: Arie Peterson <arie@greenhost.nl> Date: Thu, 30 Mar 2023 12:05:52 +0200 Subject: [PATCH] Use readonly instead of disabled for email input in settings --- backend/web/static/base.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/web/static/base.js b/backend/web/static/base.js index 79b71d3a..1a08b477 100644 --- a/backend/web/static/base.js +++ b/backend/web/static/base.js @@ -376,12 +376,12 @@ function getFormElement(node, context) { if (name == 'email' || name == 'traits.email') { var label; - var disable; + var readonly; if (context == 'settings') { - disable = true; + readonly = true; label = 'Changing your e-mail address is not supported at this point.'; } else { - disable = false; + readonly = false; label = 'Please provide your e-mail address. We will send a recovery link to that e-mail address.'; } return getFormInput( @@ -392,7 +392,7 @@ function getFormElement(node, context) { 'Please enter your e-mail address here', label, messages, - disable, + readonly, ); } @@ -494,12 +494,13 @@ function getFormElement(node, context) { // param placeHolder: Label to display in field if empty // param help: Additional help text, displayed below the field in small font // param messages: Message about failed input -function getFormInput(type, name, value, label, placeHolder, help, messages, disable) { +// param readonly: Whether the input should be readonly (defaults to false) +function getFormInput(type, name, value, label, placeHolder, help, messages, readonly) { if (typeof help == 'undefined' || help == null) { help = ''; } - if (typeof disable == 'undefined') { - disable = false; + if (typeof readonly == 'undefined') { + readonly = false; } console.log('Messages: ', messages); @@ -528,8 +529,8 @@ function getFormInput(type, name, value, label, placeHolder, help, messages, dis if (placeHolder) { element += 'placeholder="' + placeHolder + '" '; } - if (disable) { - element += 'disabled '; + if (readonly) { + element += 'readonly '; } element += '>'; -- GitLab