Skip to content

Commit

Permalink
Merge pull request #1039 from BoSen29/patch-1
Browse files Browse the repository at this point in the history
Add param to autofocus textbox on load. #564
  • Loading branch information
adamdriscoll authored Aug 23, 2019
2 parents ba2ad9e + 6749fbc commit 7e344ef
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/UniversalDashboard/Controls/src/textbox.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@ function New-UDTextbox {
[Parameter()]
[Switch]$Disabled,
[Parameter()]
[UniversalDashboard.Models.FontAwesomeIcons]$Icon
[UniversalDashboard.Models.FontAwesomeIcons]$Icon,
[Switch]$Autofocus
)

$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
If ($Autofocus) {
$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
autofocus = "true"
}
}
else {
$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
}
}


if ($Disabled) {
$Attributes.disabled = $true
Expand All @@ -43,4 +55,4 @@ function New-UDTextbox {
} -Content { $Label }
}
}
}
}

0 comments on commit 7e344ef

Please sign in to comment.