Up to version 2.7.0 whenever you use validation with new-udinput, the moment you click on the second box the green circle will spin and do the validate and provide the error message as expected.
recently with nightly builds the green circle will spin and nothing like what you have entered is valid, then when you click submit you get the validation error.
based on my testing the issue is in the client folder cause when i replace client folder with an older version or with the current one from 2.7.0 it works again.
here is a sample
Get-UDDashboard | Stop-UDDashboard
Start-UDDashboard -Dashboard (
New-UDDashboard -Title "Test" -Content {
New-UDInput -Title 'Restore Staging DBs' -SubmitText 'Continue' -Content {
New-UDInputField -Type 'textbox' -Name 'UserName' -Placeholder 'User Name'
New-UDInputField -Type 'password' -Name 'password' -Placeholder 'Password'
} -Endpoint {
param(
[Parameter(Mandatory = $True)]
[UniversalDashboard.ValidationErrorMessage("UserName is inavalid or you don't have rights, please check!")]
[ValidateScript( {
$Members = Get-ADGroupMember -Identity 'Test' -Recursive | Select -ExpandProperty SamAccountName
if ($Members -contains $_) {
$True
$Session:U = $_
}
else { Throw "error" }
})]
$UserName,
[Parameter(Mandatory = $True)]
[UniversalDashboard.ValidationErrorMessage("Password is inavalid, please check!")]
[ValidateScript( {
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$obj = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain', 'lms.local')
if (($obj.ValidateCredentials($Session:U, $_)) -eq $True) {
$True
}
else { Throw "error" }
})]
$Password
)
} -Validate
}
) -Port 80 -wait