From b4506a0a3e103cde5d6aca8295b7314144d58d9b Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Fri, 27 Feb 2026 17:44:15 +1100 Subject: [PATCH] fix: disable mode select until email is entered --- ident_switch-form.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ident_switch-form.js b/ident_switch-form.js index 56e0b04..dcf5fbe 100644 --- a/ident_switch-form.js +++ b/ident_switch-form.js @@ -56,10 +56,13 @@ function plugin_switchIdent_init() { $("INPUT[name='_ident_switch.form.sieve.host']").attr('placeholder', initialImapHost); } - // Re-apply preconfig from current email (handles form re-render after create abort - // where PHP record may lack email, so readonly was not set server-side) + // Disable mode select until a valid email is entered + var $modeSelect = $("SELECT[name='_ident_switch.form.common.mode']"); if (initialEmail && initialEmail.indexOf('@') > 0) { + $modeSelect.prop('disabled', false); plugin_switchIdent_onEmailChange(initialEmail); + } else { + $modeSelect.prop('disabled', true); } } @@ -278,6 +281,9 @@ function plugin_switchIdent_onEmailChange(email) { var domain = email.substring(atPos + 1).toLowerCase(); if (!domain) return; + // Enable mode select now that we have a valid email + $("SELECT[name='_ident_switch.form.common.mode']").prop('disabled', false); + // Update label and username placeholders to match current email $("INPUT[name='_ident_switch.form.common.label']").attr('placeholder', email);