Add function to auto-select dependent fields
This commit is contained in:
parent
c282cfcff3
commit
74a6028c76
|
@ -39,6 +39,18 @@
|
||||||
field.textContent = newValue;
|
field.textContent = newValue;
|
||||||
field.classList.toggle("humanTLToggled");
|
field.classList.toggle("humanTLToggled");
|
||||||
|
|
||||||
|
if (field.classList.contains("humanTLToggled") === false) return;
|
||||||
|
|
||||||
|
let dependencies = field.getAttribute("data-dependencies");
|
||||||
|
if (dependencies !== undefined && dependencies !== null) {
|
||||||
|
let linkedFields = dependencies.split(";");
|
||||||
|
for (let i = 0, max = linkedFields.length; i < max; i++) {
|
||||||
|
let linkedField = document.getElementById(linkedFields[i]);
|
||||||
|
if (linkedField.classList.contains("humanTLToggled") === true) continue;
|
||||||
|
toggleListFieldSelectionState(linkedField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doForFieldList(function(field) {
|
doForFieldList(function(field) {
|
||||||
|
|
15
index.php
15
index.php
|
@ -66,7 +66,8 @@ require __DIR__ . "/values/availableFields.php";
|
||||||
$tooltips = [];
|
$tooltips = [];
|
||||||
foreach ($availableFields as $headline => $fields) {
|
foreach ($availableFields as $headline => $fields) {
|
||||||
|
|
||||||
echo "<h3>{$headline}</h3>
|
echo "
|
||||||
|
<h3>{$headline}</h3>
|
||||||
<ul class='fieldList'>
|
<ul class='fieldList'>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
@ -76,10 +77,14 @@ foreach ($availableFields as $headline => $fields) {
|
||||||
else $hasTooltip = false;
|
else $hasTooltip = false;
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<li data-alt='{$field['name_human_readable']}' data-value='{$fieldName}' data-for='{$fieldName}' class='";
|
<li id='{$fieldName}' data-alt='{$field['name_human_readable']}' data-value='{$fieldName}' data-for='{$fieldName}' class='";
|
||||||
if ($hasTooltip === true) echo " newToolTipTag";
|
if ($hasTooltip === true) echo " newToolTipTag";
|
||||||
if ($field['required'] === true) echo " requiredField";
|
if ($field['required'] === true) echo " requiredField";
|
||||||
echo "'>{$fieldName}";
|
echo "'";
|
||||||
|
if (!empty($field['dependsOn'])) {
|
||||||
|
echo " data-dependencies='" . htmlspecialchars(implode(";", $field['dependsOn'])) . "'";
|
||||||
|
}
|
||||||
|
echo ">{$fieldName}";
|
||||||
|
|
||||||
if (!empty($field['explica'])) $toolTipExplica = "</p><h5>General</h5><p>" . $field['explica'];
|
if (!empty($field['explica'])) $toolTipExplica = "</p><h5>General</h5><p>" . $field['explica'];
|
||||||
else $toolTipExplica = "";
|
else $toolTipExplica = "";
|
||||||
|
@ -88,7 +93,9 @@ foreach ($availableFields as $headline => $fields) {
|
||||||
echo "</li>";
|
echo "</li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul>';
|
echo '
|
||||||
|
</ul>
|
||||||
|
';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user