Is there a way to clear a New-UDInputField? I’m working on a sign in/out log where you walk up and search for your name. You hit the Check Out Button next to your name and the below code runs.
https://pastebin.com/skemJ5rH
What i would like to know, is there a way to clear the original input field OR refresh the page once you fill out the Input on the linked code.
IF this doesn’t make sense, feel free to let me know 
Use a Session variable, set it to true once it’s clicked, and then Sync the element that contains the input.
My input field:
New-UDElement -Id 'eUserName' -Tag Div -Endpoint {
if ($Session:bClicked -eq $true) {
New-UDTextbox -Placeholder 'UserName' -Value 'Cleared!'
} else {New-UDTextbox -Placeholder 'UserName' -Value 'John Wayne'}
}
Your Check Out Onclick:
New-UDButton -Text "Check Out" -OnClick (
New-UDEndpoint -Endpoint {
$Session:bClicked = $true
$student = Get-ADUser $($ArgumentList[0]) -Properties Description
$id = 0 + $student.Description
$name = $student.Name
Sync-UDElement -Id eUserName
Show-UDModal -Header {
New-UDHeading -Size 4 -Text "$name checking out"
} -Content {
New-UDInput -Content {
New-UDInputField -Type "select" -Name "coReason" -Placeholder "Checking out Reason" -Values @("Dual Enrollment", "Off-Campus Lunch")
} -Endpoint {
param($coReason)
$ConnectionString = "User ID=postgres;password=[REDACTED];host=[REDACTED];Database=ud_db"
$params = @{"cor"=$coReason; "id"=$id}
"INSERT INTO checkout_table (student_id, checkout_reason, checkout_time) VALUES (@id, @cor, current_timestamp);" | Invoke-PostgreSqlQuery -Parameters $params -ConnectionString $ConnectionString -CUD
Hide-UDModal
Clear-UDElement -Id "deLog"
New-UDInputAction -Toast "Checked Out Successfully" -Duration "10000"
}
}
} -ArgumentList $($_.ObjectGUID)
)