Any Ideas on why this isn’t working?
New-UDDashboard -Title 'End User Search' -DefaultTheme dark -Content {
$DefaultSearch = ""
if ($Enduser -ne $null)
{
$DefaultSearch = $Enduser
New-UDTypography -Text "URL invoked search for ($Enduser)" -variant h6
}
New-UDGrid -Container -Content {
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDCard -Title "Search SAMACCONTNAME" -Content {
New-UDForm -Id 'usersearchform' -Content {
New-UDTextbox -Id 'txtTextField' -Value $DefaultSearch -Autofocus
} -OnSubmit {
Show-UDToast -Message $EventData.txtTextField
}
}
}
}
}
Product: PowerShell Universal
Version: 2.10.2
been away from Universal so long that I cant even remember the basics “-Autofocus only work in dynamic regions”
Autofocus on Input fields and buttons - Universal Dashboard / Universal Dashboard Help - Ironman Software Forums
So @adam back in the day we had to define dynamic stuff in -endpoints {}, instead of -content {}. is that not really a thing in PSU?
How does -autofocus work in PSU?
Select-udelement in the end of a page will do the trick for “autofocus” but I’m still wondering how to use -autofocus correctly.
adam
May 10, 2022, 7:51pm
3
We’ve got a casing but here. The PS script is setting “autofocus” while the JavaScript component is expecting “autoFocus”. You can actually work around this by creating a hashtable directly.
@{
type = 'mu-textbox'
id = 'txtTextField'
autoFocus = $true
}
No need for any dynamics. Pages are always dynamic now.
Zep
August 8, 2025, 10:10am
4
Can you please elaborate? How should this hashtable be applied?
Would this way be working for UDAutocomplete as well?
Thanks in advance