CheckBox variable type differ between 2.3.1 & 2.5.3

In 2.3.1 a CheckBox variable type is returned as a boolean but in 2.5.3 the type is a string.

New-UDInputField -Name "BetGame" -Type "checkbox" -Placeholder "Bet Game?" -DefaultValue $setBet;

Also the default value is not honored in either version. If $setBet is $true, I would expect the checkbox to contain a check mark when displayed.

Not sure if I should create an issue(s) for this or if it is something I’m doing wrong.

Looks like a bug. Can you please raise an issue?

Yes. Will do. Thanks.

Here is some code that demonstrates that New-UDInputField is always returning a string type variable regardless of the type being specified.


#Import-Module UniversalDashboard.Community -RequiredVersion 2.5.3
Import-Module UniversalDashboard.Community -RequiredVersion 2.3.1

$UDTheme = New-UDTheme -Name "Basic" -Definition @{
  '.card-content' = @{
    'display' = 'grid'
  }
}

$CheckBox = New-UDDashboard -Title "CheckBox Tester" -Theme $UDTheme -Content {
  New-UDLayout -Column 1 -Content { 
    New-UDColumn -Size 3 -Content {
      New-UDInput -Title "Select # of games to play" -FontColor "Blue" -Content {
        $v0 = $true; $v1 = $true; [int]$cnt=3;
        New-UDInputField -Name "Games" -Type "select" -Values ("1","2","3","4","5") -DefaultValue $cnt;
        New-UDInputField -Name "Check1" -Type "checkbox" -Placeholder "Is it daytime?" -DefaultValue $v1;
        New-UDInputField -Name "Check2" -Type "checkbox" -Placeholder "Is it before noon?" -DefaultValue $v0;
      } -EndPoint {
        param($Games,$Check1,$Check2)
          Show-UDToast -Id "Games" -Message "You selected $Games games to play." -Duration 10000;
          $type = $Games.gettype().name;
          $msg = "Games var type: " + $type;
          Show-UDToast -Id "Selecttype" -Message $msg -Duration 10000;
          Start-Sleep -seconds 5;
          Hide-UDToast -Id "Games"
          Hide-UDToast -Id "Selecttype"
          $type = $Check1.gettype().name;
          $msg = "daytime var type: " + $type;
          Show-UDToast -Id "Checktype" -Message $msg -Duration 10000;
          Start-Sleep -seconds 5;
      }
    }
  }  
}

Start-UDDashboard -Name "CheckBoxer" -Dashboard $CheckBox -Port 10009```

Be sure to exit the current PowerShell session after changing the module version being imported.

New-UDInputField always returns string type variable 2.5.3 #1095