I've got a <textarea>
set up in a Sitecore Form in which users can enter multi line inputs:
When the value is saved to the database I notice that the breaks ARE preserved:
If I copy the value from the database and paste it in Notepad++, it appears as follows:
Line 1
Line 2
Line 3
So far so good. However, when the form submissions are exported to CSV, the data appears to lose any new line information.
When pulling this data I need to be able to find and replace instances of new lines because I want to display the CSV data in a table using the following borrowed PowerShell code:
function Get-FormData {
param (
[parameter(mandatory=$true)]
[Sitecore.Data.ID]$FormID,
[parameter(mandatory=$false)]
[Nullable[DateTime]]$StartDate,
[parameter(mandatory=$false)]
[Nullable[DateTime]]$EndDate
)
$provider = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService([Sitecore.ExperienceForms.Data.IExportDataProvider])
$content = $provider.Export($FormID.Guid, $StartDate, $EndDate).Content
if (-not $content) {
return $null
}
# Not working: replace new line chars with HTML breaks for table display
$content = $content.replace("'n","<br/>").replace("'r","<br/>").replace("\\r\\n","<br/>").replace("\r\n","<br/>")
$content | ConvertFrom-Csv -Delimiter ';'
}
Have you any ideas how we can preserve this new line data when pulling it from the database?
Line_1__Line_2___Line_3
. This indicates to me that the Sitecore implementation of that method appears to be the limiting factor here?