attempt to get the password field to show up
This commit is contained in:
@@ -274,7 +274,6 @@ function Build-Checkboxes {
|
|||||||
if ($_.SubOptions) {
|
if ($_.SubOptions) {
|
||||||
Write-Host "👉 Rendering SubOptions for task $taskId"
|
Write-Host "👉 Rendering SubOptions for task $taskId"
|
||||||
|
|
||||||
# Build the sub-checkboxes
|
|
||||||
$subHtml = (
|
$subHtml = (
|
||||||
$_.SubOptions | ForEach-Object {
|
$_.SubOptions | ForEach-Object {
|
||||||
"<label style='margin-left:20px; display:block;'>
|
"<label style='margin-left:20px; display:block;'>
|
||||||
@@ -283,15 +282,14 @@ function Build-Checkboxes {
|
|||||||
}
|
}
|
||||||
) -join "`n"
|
) -join "`n"
|
||||||
|
|
||||||
# Append HTML + inline script
|
|
||||||
$html += @"
|
$html += @"
|
||||||
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
|
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
|
||||||
$subHtml
|
$subHtml
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
(function() {
|
||||||
const masterCheckbox = document.getElementById('${($_.Id)}');
|
const masterCheckbox = document.getElementById('${taskId}');
|
||||||
const container = document.getElementById('${($_.Id)}OptionsContainer');
|
const container = document.getElementById('${taskId}OptionsContainer');
|
||||||
|
|
||||||
if (masterCheckbox && container) {
|
if (masterCheckbox && container) {
|
||||||
const passwordContainer = document.getElementById("PasswordContainer");
|
const passwordContainer = document.getElementById("PasswordContainer");
|
||||||
@@ -299,21 +297,17 @@ $subHtml
|
|||||||
|
|
||||||
function updateDisplay(checked) {
|
function updateDisplay(checked) {
|
||||||
container.style.display = checked ? 'block' : 'none';
|
container.style.display = checked ? 'block' : 'none';
|
||||||
|
container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
|
||||||
|
|
||||||
if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
|
if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
|
||||||
if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
|
if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
|
||||||
container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
masterCheckbox.addEventListener('change', function () {
|
masterCheckbox.addEventListener('change', () => updateDisplay(masterCheckbox.checked));
|
||||||
updateDisplay(this.checked);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initial state on load
|
|
||||||
updateDisplay(masterCheckbox.checked);
|
updateDisplay(masterCheckbox.checked);
|
||||||
}
|
}
|
||||||
});
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
"@
|
"@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user