I am trying to validate the user has agreed they performed x, y, & z by a checkbox. For some reason, I cannot get it to stop, and continues on. Everything else in my validation section is working as expected.
Am I doing something wrong?
} -OnValidateStep {
$Context = $EventData
if ($Context.CurrentStep -eq 0 -and $Context.Context.txtStep1 -eq '' -or $Context.Context.txtStep1 -eq $null) {
New-UDValidationResult -ValidationError "You must enter a location #."
} else {
if ($($Context.Context.txtStep1) -match "^\d{1,4}\Z") {
New-UDValidationResult -Valid
} else {
New-UDValidationResult -ValidationError "Only numerical values are accepted."
}
}
Show-UDToast -Message "Checkbox: $($Context.Context.chkConfirmClearQM)" -Duration 5000
Show-UDToast -Message "What Step: $($Context.CurrentStep)" -Duration 5000
Show-UDToast -Message "Returning: $Body" -Duration 5000
if ($($Context.CurrentStep) -eq 1 -and ! $($Body.Context.chkConfirmClearQM)) {
New-UDValidationResult -ValidationError "You must confirm that you followed the above steps."
} else {
New-UDValidationResult -Valid
Show-UDToast -Message "$($Body.Context.chkConfirmClearQM)" -Duration 10000
}
}
Product: PowerShell Universal
Version: 2.1.2