Commit 995f6d7d authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Correction : affichage valeur de la condition

parent 28f5e5dd
......@@ -38,8 +38,10 @@ $line = 1;
$options = json_decode($value['Champ']['details'], true);
$fieldConditions = json_decode($options['conditions'], true);
$conditions = array_merge($conditions, $fieldConditions);
if (isset($options['conditions']) && !empty($options['conditions'])) {
$fieldConditions = json_decode($options['conditions'], true);
$conditions = array_merge($conditions, $fieldConditions);
}
?>
<div class="row row35">
......@@ -272,6 +274,7 @@ $line = 1;
// Mise en place des conditions
var conditions = <?php echo json_encode($conditions); ?>;
console.log(conditions);
$.each(conditions, function (key, value) {
shownHideField(value['ifNot'], value['thenTheField']);
......@@ -290,19 +293,26 @@ $line = 1;
}
});
} else {
if ($('#' + value['hasValue']).prop("checked") == true) {
shownHideField(value['mustBe'], value['thenTheField'])
} else {
shownHideField(value['ifNot'], value['thenTheField']);
}
if ($('#'+value['hasValue']).attr('type') == 'radio') {
$('#' + value['hasValue']).on('change', function () {
if ($(this).prop("checked") == true) {
console.log($('#'+value['hasValue']).parent());
}
else {
if ($('#'+value['hasValue']).prop("checked") == true) {
shownHideField(value['mustBe'], value['thenTheField'])
} else {
shownHideField(value['ifNot'], value['thenTheField']);
}
});
$('#'+value['hasValue']).on('change', function () {
if ($(this).prop("checked") == true) {
shownHideField(value['mustBe'], value['thenTheField'])
} else {
shownHideField(value['ifNot'], value['thenTheField']);
}
});
}
}
});
......
......@@ -923,6 +923,11 @@ var createForm = function(typeCreateForm) {
if (!hasValue) {
hasValue = $('#'+value['hasValue']).labels().text();
//Radios
if (!hasValue) {
hasValue = $('#'+value['hasValue']).attr('value');
}
}
if (value['mustBe'] == 'shown') {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment