Keep string field formatting in UI Page

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I've got a UI Page that I am trying display some fields from one of my tables on. I have some multiline string fields that I am displaying on the UI Page, but when I display them, they lose all the formatting, specifically returns.

For example, if my string field on the form looks like this:

Here is some text
Here is more text

Then on the UI Page it looks like this:

Here is some text Here is more text

Is there any way to keep the formatting when displaying the data in the UI Page? It works just fine if I include those fields in email notifications.

5 REPLIES 5

Hi all,



Sorry for coming late into this but I had the very same problem when displaying in a multiline field. I solved the problem as follows:



1) Applied Escape HTML to the text which needs to be displayed


2) Added a div with contenteditable:


<div contenteditable="true"><g:no_escape>${jvar_customer_message}</g:no_escape></div>



This will retain the HTML formatting. The div alone does not display as an input field. However you can adding HTML styling to make it look like an input field.