[9.2.13] form affichage des options des champs

This commit is contained in:
fredtempez 2019-12-04 11:46:23 +01:00
parent 130895b5d9
commit 014e252d0d
1 changed files with 16 additions and 9 deletions

View File

@ -123,15 +123,22 @@ $("#formConfigInputs")
// Affiche/cache le champ "Valeurs" en fonction des champs cachés // Affiche/cache le champ "Valeurs" en fonction des champs cachés
.on("change", ".formConfigType", function() { .on("change", ".formConfigType", function() {
var _this = $(this); var _this = $(this);
if(_this.val() === "select") { switch (_this.val()) {
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown(); case "select":
} else if ( _this.val() === "label") { _this.parents(".formConfigInput").find("label[for*=formConfigRequired]").show();
_this.parents(".formConfigInput").find("label[for*=formConfigRequired]").hide(); _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown();
_this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideDown(); _this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideUp();
} break;
else { case "label":
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); _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 // Simule un changement de type au chargement de la page
$(".formConfigType").trigger("change"); $(".formConfigType").trigger("change");