Autofocus on Input fields and buttons

Thanks man! I appreciate your help on this.

1 Like

I wanted to come back after I had a chance to test this and say thanks again. This works great and was exactly what I needed!

3 Likes

How do you set the autofocus param on a textbox when adding the box as a [string]param or as a New-UDInputField?

I can see the Autofocus parameter in the code for New-UDTextbox, but that doesn’t help me all that much.

This didn’t work for me, I just want to run Select-UDElement -Id <> and have the cursor land in the UDInputField I have created within my UDInput, but their isn’t an ID param for a UDInputField.

Hey All, I see that there was already a lot of work on this so far. I wanted to know if anyone had any luck doing an auto select within a textbox with a form. I saw BoSen29’s post about this showing up on load and not dynamically. I am thinking that should still work here, but maybe i am mistaken :smile: have tried using the -AutoFocus, as well as the Select-UDElement, but it doesn’t seem to make a difference where the form is concerned. Here is what the form looks like “unselected”:

And here it is after clicking in the box:

If it helps at all, this is what the code snippet looks like:

New-UDForm -ID 'Form_ADLookup'  -content {
                    New-UDRow -Columns {
                        New-UDColumn -SmallSize 4 -LargeSize 4 -content{
                                New-UDTextBox -ID "Username" -Label "Enter Name or ID" -value $AdObjectFromURL -AutoFocus  #Get username
                                 Select-UDElement -id "Username"
                        }

I appreciate any suggestions or insights that you guys might have on this!

PSUD 2.5.0 via MSI install