changes for the password field
This commit is contained in:
@@ -290,26 +290,30 @@ $subHtml
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const master = document.getElementById('$taskId');
|
||||
const container = document.getElementById('${taskId}OptionsContainer');
|
||||
const subCheckboxes = container.querySelectorAll('.sub-option-$taskId');
|
||||
const masterCheckbox = document.getElementById('${($_.Id)}');
|
||||
const container = document.getElementById('${($_.Id)}OptionsContainer');
|
||||
|
||||
if (masterCheckbox && container) {
|
||||
const passwordContainer = document.getElementById("PasswordContainer");
|
||||
const dattoContainer = document.getElementById("dattoRmmContainer");
|
||||
|
||||
if (master && container) {
|
||||
// Toggle visibility + check state
|
||||
const toggleSubs = () => {
|
||||
const show = master.checked;
|
||||
container.style.display = show ? 'block' : 'none';
|
||||
subCheckboxes.forEach(cb => cb.checked = show);
|
||||
};
|
||||
function updateDisplay(checked) {
|
||||
container.style.display = checked ? 'block' : 'none';
|
||||
if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
|
||||
if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
|
||||
container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
|
||||
}
|
||||
|
||||
// Bind event
|
||||
master.addEventListener('change', toggleSubs);
|
||||
masterCheckbox.addEventListener('change', function () {
|
||||
updateDisplay(this.checked);
|
||||
});
|
||||
|
||||
// Handle page load if pre-checked
|
||||
if (master.checked) toggleSubs();
|
||||
// Initial state on load
|
||||
updateDisplay(masterCheckbox.checked);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
"@
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user