[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
.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");