Set-UDElement not working

Product: PowerShell Universal
Version: 1.5.19

I’m passing a value to a page using a querystring. My page should then set an element based on the value passed into the page. It seems the Set-UDElement component isnt working for me in 1.5.19.

For example, I passed in ?searchval=PowerShellUniversal and the page only displays:

SearchVal: PowerShellUniversal
A value was passed in

Here is the code I am using:

New-UDTypography -Text "SearchVal: $($searchval)"

if($searchval) { 
	New-UDHTML -Markup "<BR>"
	New-UDTypography -Text "A value was passed in"
	Set-UDElement -id 'results' -Content { "The value that was passed in: $($searchval)"}
}
else {
	New-UDTypography -Text "No value was passed in"
}

New-UDElement -Tag 'div' -id 'results'

Setting the element during page load won’t work like this because the element isn’t on the page yet when Set-UDElement is called.

For example, if you were to click this button, it would work since it happens after the page loads.

New-UDDashboard -Title 'Test' -Content {
New-UDTypography -Text "SearchVal: $($searchval)"

if($searchval) { 
	New-UDHTML -Markup "<BR>"
	New-UDTypography -Text "A value was passed in"
	Set-UDElement -id 'results' -Content { "The value that was passed in: $($searchval)"}
}
else {
	New-UDTypography -Text "No value was passed in"
}

New-UDButton -Text 'click' -OnClick {
	Set-UDElement -id 'results' -Content { "The value that was passed in: $($searchval)"}
}

New-UDElement -Tag 'div' -id 'results'
}