I am new to this.
I am trying to pre-populate or provide a value on textbox but the label overlaps with value I supplied using Set-UDElement.
I want the label to get smaller, similar to the action when you manually click and enter the value using mouse and keyboard.
Below is the code I used.
Get-UDDashboard | Stop-UDDashboard
$Layout = ‘{“lg”:[{“w”:1,“h”:1,“x”:0,“y”:0,“i”:“grid-element-02012e7c-a91c-41cf-ad20-9b0be3b83235”,“moved”:false,“static”:true},{“w”:1,“h”:1,“x”:0,“y”:1,“i”:“grid-element-4d97012c-583b-4147-a2f9-3632c714164f”,“moved”:false,“static”:true},{“w”:3,“h”:2,“x”:2,“y”:0,“i”:“grid-element-btnSearch”,“moved”:false,“static”:true}]}’
$Dashboard = New-UDDashboard -Title “New-UDGridLayout” -Content {
New-UDGridLayout -Layout $Layout -Id ‘grid’ -Content {
New-UDTextbox -Id 'txtServerName' -Label 'ServerName' #-Placeholder 'ServerName'
New-UDTextbox -Id 'txtServerName2' -Label 'ServerName2' #-Placeholder 'ServerName2'
New-UDButton -Id 'btnSearch' -Text 'Pass Value of ServerName to ServerName2' -OnClick {
$Cache:ServerName = (Get-UDElement -Id 'txtServerName').Attributes['value']
Set-UDElement -Id "txtServerName2" -Attributes @{
type = "text"
value = $Cache:ServerName
}
}
}
}
Start-UDDashboard -Dashboard $Dashboard -Port 10000