Thanks. Planning on taking over the world with UD. You’ve contributed alot to this platform !! Doing my development with UD V3. Will play with this component later today. Thanks for the hard work.
Amazing work! I’m going to have a play around with it this evening
I’ve tried the component that @psDevUK created, but it didn’t seem to work with UD v3… I’m trying to figure out another solution for a multi line textbox.
By any chance, do you have code you can share for grabbing the text/value from the text area box created with New-UDElement -Tag ‘textarea’ ?
I’m new to UD, and just trying the usual way with Get-UDElement, but the hashtable returned doesn’t seem to have anything of interest in it.
There is a -Multiline parameter for New-UDTextbox in UD v3. I’d suggest using that and then Get-UDElement will work.
Thanks! Saved me a ton of time.
Hi Adam,
Is there any way of maintaining formatting for input text in a multiline textbox? It looks like the newlines are lost, or parsed/changed to spaces.
Thanks
I just tested this and it looks like when using it in something like Show-UDToast
it’s converting it to spaces for some reason but when I output it to a file it’s maintaining the spaces.
New-UDDashboard -Title "Server Monitor" -Content {
New-UDTextbox -Id 'text' -Placeholder 'tester' -Multiline -Rows 5
New-UDButton -OnClick {
(Get-UDElement -Id 'text').value | Out-File C:\users\adamr\desktop\test.txt
}
}
The resulting file looks like.
asdf
asdf
asdf
asdf
So the newline characters are being preserved from the textfield but likely lost when you are trying to do it with some other component. How are you using the data?
Hi Adam, apologies for the late response.
I’ve tested a little bit, my problem turned out to be in one of my own functions. I was grabbing some data from a form, and writing it to a database. Formatting was important & needed to be maintained.
In my testing I’ve noticed that passing the multiline textbox values to something like UDTable or outputting in UDPaper, the formatting gets lost. I’m running PSU 1.4.2, and for my dashboard UD Framework 3.1.0.
Heres my sample page I used to test:
New-UDPage -Name 'Test Page' -Content { $Session:InputValues = 'asdasdasd' $Session:Table = @{ InputValue = $Session:InputValues } New-UDCard -Title 'Test Card' -Content { New-UDForm -Content { New-UDTextbox -Label 'Values' -Id 'InputValues' -Placeholder 'Placeholder Text' -Multiline } -OnSubmit { $FormContent = $Body | ConvertFrom-Json $Session:InputValues = $FormContent.InputValues $Session:Table = @{ InputValue = $Session:InputValues } $Message = "ToastMessage! Input values are $($SessionInputValues)" Show-UDToast -Message $Message -Duration 10000 Sync-UDElement -Id 'SampleTable' Sync-UDElement -Id 'SamplePaper' } } New-UDDynamic -Id 'SampleTable' -Content { if ($Session:Table) { $Columns = @( New-UDTableColumn -Property InputValue -Title 'InputValue' ) New-UDTable -Data $Session:Table -Columns $Columns -Export -Filter -Search } } New-UDDynamic -Id 'SamplePaper' -Content { if ($Session:InputValues) { New-UDPaper -Content {"input values are $($Session:InputValues)"} New-UDPaper -Content {"type is $($Session:InputValues.GetType())"} } } }