In the code below, the OnEnter event is never triggered when pressing Enter in the textbox. This works fine when a textbox is used in a form. We would really like to be able to just press Enter in the Stepper instead of having to use the mouse for clicking Next. I guess I can simulate the Next press with New-ValidationResult?
New-UDStep -Id 'step0' -OnLoad {
New-UDElement -tag 'div' -Content { "User initials:" }
New-UDTextbox -Id 'txtInitials' -Variant 'outlined' -Label 'Initials' -Autofocus -OnEnter {
Show-UDToast -Message "Enter"
}
} -Label "Initials"Product: PowerShell Universal Version: 4.0.0-beta4
Looks like there is a bug with -OnEnter outside of a form. This will be resolved in 3.9.6 and v4.
You’ll then be able to do this.
New-UDStepper -Id 'stepper' -Children {
New-UDStep -Label 'Step1' -OnLoad {
New-UDTextbox -Id 'txtInitials' -Variant 'outlined' -Label 'Initials' -Autofocus -OnEnter {
Show-UDToast 'Hello'
Set-UDElement -Id 'stepper' -Properties @{
activeStep = 1
}
}
}
New-UDStep -Label 'Step2' -OnLoad {
}
} -OnFinish {
}Adam Driscoll
PowerShell Expert and Developer at Devolutions
Thanks @Adam Driscoll, the OnEnter now works (4.0.0 Release). However, it appears to skip the OnValidateStep for step0 when setting activeStep this way…?!