Hello,
I try to set the Checked attribute on a checkbox but it doesn’t work.
If I make a choice in the Select, the OnChange event is triggered and the switch works properly but the checkboxes are never updated …
Any idea ?
Here is my script :
New-UDCheckBox -Id "Intranet" -Label $Cache:ADGroupIntranet.Name -Checked -OnChange { }
New-UDCheckBox -Id "IwsUsers" -Label $Cache:ADGroupIWSUsers.Name -Checked -OnChange { }
New-UDSelect -Id "EmployeeIDSelect" -Label "Utilisateur" -Option {
New-UDSelectOption -Name "sans matricule connu" -Value "NEWMAT"
New-UDSelectOption -Name "avec matricule" -Value "Saisir le matricule"
New-UDSelectOption -Name "externe" -Value "EXTERN"
} -OnChange {
switch ((Get-UDElement -Id "EmployeeIDSelect").Attributes["value"]) {
"NEWMAT" {
Remove-UDElement -Id "EmployeeID"
Set-UDElement -Id "Intranet" -Attributes @{
checked = $true
}
Set-UDElement -Id "IwsUsers" -Attributes @{
checked = $true
}
}
"EXTERN" {
Remove-UDElement -Id "EmployeeID"
Set-UDElement -Id "Intranet" -Attributes @{
checked = $false
}
Set-UDElement -Id "IwsUsers" -Attributes @{
checked = $false
}
}
Default {
Add-UDElement -ParentId "EmployeeIDColumn" -Content {
New-UDTextbox -Id "EmployeeID" -Placeholder "Matricule"
}
Set-UDElement -Id "Intranet" -Attributes @{
checked = $true
}
Set-UDElement -Id "IwsUsers" -Attributes @{
checked = $true
}
}
}
}