From 014e252d0d7daa42f648ceaf86cf204049d2be31 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 4 Dec 2019 11:46:23 +0100 Subject: [PATCH] [9.2.13] form affichage des options des champs --- module/form/view/config/config.js.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/module/form/view/config/config.js.php b/module/form/view/config/config.js.php index 60977381..8b4d4fb0 100644 --- a/module/form/view/config/config.js.php +++ b/module/form/view/config/config.js.php @@ -123,15 +123,22 @@ $("#formConfigInputs") // Affiche/cache le champ "Valeurs" en fonction des champs cachés .on("change", ".formConfigType", function() { var _this = $(this); - if(_this.val() === "select") { - _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown(); - } else if ( _this.val() === "label") { - _this.parents(".formConfigInput").find("label[for*=formConfigRequired]").hide(); - _this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideDown(); - } - else { - _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); - } + switch (_this.val()) { + case "select": + _this.parents(".formConfigInput").find("label[for*=formConfigRequired]").show(); + _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown(); + _this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideUp(); + break; + case "label": + _this.parents(".formConfigInput").find("label[for*=formConfigRequired]").hide(); + _this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideDown(); + _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); + break; + default: + _this.parents(".formConfigInput").find("label[for*=formConfigRequired]").show(); + _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); + _this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideUp(); + } }); // Simule un changement de type au chargement de la page $(".formConfigType").trigger("change");