From 8ae410185fb474c7529abcf3b74eb40e1389da9b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 19 Mar 2018 15:36:03 +0100 Subject: [PATCH] Try to preserve radio button values of disabled options --- wcfsetup/install/files/js/WCF.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index dc50cbd2d4..c362627f1a 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3753,8 +3753,21 @@ if (COMPILER_TARGET_DEFAULT) { var $tagName = element.getTagName(); if ($tagName == 'select' || ($tagName == 'input' && (element.attr('type') == 'checkbox' || element.attr('type') == 'file' || element.attr('type') == 'radio'))) { - if (enable) element.enable(); - else element.disable(); + if ($tagName === 'input' && element[0].type === 'radio') { + if (!element[0].checked) { + if (enable) element.enable(); + else element.disable(); + } + else { + // Skip active radio buttons, this preserves the value on submit, + // while the user is still unable to move the selection to the other, + // now disabled options. + } + } + else { + if (enable) element.enable(); + else element.disable(); + } if (element.parents('.optionTypeBoolean:eq(0)')) { // escape dots so that they are not recognized as class selectors -- 2.20.1