I am building a new input form, I am trying to run some basic validation on the input from the user. Following the documentation, I can make this work using New-UDInput with a param, similar to this:
New-UDInput -Endpoint {
param(
[Parameter(Mandatory)]
[ValidateLength(6,6)]
[UniversalDashboard.ValidationErrorMessage("The employee id you entered is invalid.")]
$EmployeeID
)
However, this limits my options (at least I think) for some customization that would be needed like placeholder text. I would prefer to do validation on the New-UDInputField command instead of the entire input. I have tried putting the param right under the New-UDInputField, but can’t get it to work. Ideally something like this:
New-UDInput -Title "Password Reset" -SubmitText "Reset Password" -Content {
New-UDInputField -Name "EmployeeID" -Placeholder "6 digit Employee ID" -Type "textbox"
param(
[Parameter(Mandatory)]
[ValidateLength(6,6)]
[UniversalDashboard.ValidationErrorMessage("The employee id you entered is invalid.")]
$EmployeeID
)
Does anyone know if this is possible? If no, do you know a way I can change the input field label, like -placeholder does in New-UDInputField?